How to count the NaN values in a column in pandas DataFrame?

Posted by Editorial Staff | Updated on | Python

Want to count the NaN values in a column in pandas DataFrame? You can use the isna() method (or it’s alias isnull() which is also compatible with older pandas versions < 0.21.0) and then sum to count the NaN values. For one column:

For several columns, it also works:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers