Science, asked by jjlsfamily1221, 3 months ago

How many columns have missing values in the data dataframe ?

Answers

Answered by Anonymous
0

Pandas isnull() function detect missing values in the given object. It return a boolean same-sized object indicating if the values are NA. Missing values gets mapped to True and non-missing value gets mapped to False. Return Type: Dataframe of Boolean values which are True for NaN values otherwise False.

Calling sum() of the DataFrame returned by isnull() will give the count of total NaN in dataframe i.Explanation

Answered by luckyprabhu10
0

Answer:

You can apply a count over the rows like this:

test_df.apply(lambda x: x.count(), axis=1)

test_df:

   A   B   C

0:  1   1   3

1:  2   nan nan

2:  nan nan nan

output:

0:  3

1:  1

2:  0

You can add the result as a column like this:

test_df['full_count'] = test_df.apply(lambda x: x.count(), axis=1)

Result:

   A   B   C   full count

0:  1   1   3   3

1:  2   nan nan 1

2:  nan nan nan 0

Explanation:

please mark me as a brainiest

Similar questions