![]() |
VOOZH | about |
NaN stands for Not A Number and is one of the common ways to represent the missing value in the data. It is a special floating-point value and cannot be converted to any other type than float.
NaN value is one of the major problems in Data Analysis. It is very essential to deal with NaN in order to get the desired results.
The ways to check for NaN in Pandas DataFrame are as follows:
Example:
Output:
True
It is also possible to get the exact positions where NaN values are present. We can do so by removing .values.any() from isnull().values.any() .
Output:
0 False 1 False 2 False 3 False 4 False 5 True 6 False 7 True 8 False 9 False 10 True Name: Integers, dtype: bool
Example:
Output:
Number of NaN values present: 3
Example:
Output:
True
To get the exact positions where NaN values are present, we can do so by removing .sum().any() from isnull().sum().any() .
Example:
Output:
Number of NaN values present: 8