0

I am busy with Jupyter notebook and I need to check the first 10 entries for NaN in my Dataframe

The Code that I tried to check the first 10 entries for NaN is as follow

print("\nCount NaN in first 10 entries\n",article_read.sample(10).isnull().sum())#Count NaN in first 10 entries

Thanks in advance

Faziki
  • 767
  • 1
  • 9
  • 24
  • 1
    Use: `article_read.head(10).isna().sum()` – Erfan Aug 25 '19 at 12:59
  • @Erfan thanks man, I did not find the "How to slice a Pandas Data Frame by position? " post seems simular but your solution worked! – Faziki Aug 25 '19 at 13:04
  • It's not exactly the same solution, but your problem was that you didn't select the first 10 rows correctly, and that part is explained in the linked answer. – Erfan Aug 25 '19 at 13:12

1 Answers1

0

The following solution worked:

article_read.head(10).isna().sum()
Erfan
  • 40,971
  • 8
  • 66
  • 78
Faziki
  • 767
  • 1
  • 9
  • 24