English

How can you check whether a given DataFrame has any missing value or not?

Advertisements
Advertisements

Question

How can you check whether a given DataFrame has any missing value or not?

Code Writing
Advertisements

Solution

import pandas as pd
import numpy as np
df = pd.DataFrame({
    'A': [10, 20, np.nan],
    'B': [40, 50, 60]
})
print(df.isnull().values.any())

Output:

0, there are no missing values; otherwise, missing values are present.

shaalaa.com
  Is there an error in this question or solution?
Chapter 2: Data Handling using Pandas - I - Intext Questions [Page 53]

APPEARS IN

NCERT Informatics Practices [English] Class 12
Chapter 2 Data Handling using Pandas - I
Intext Questions | Q 1. | Page 53
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×