Sunday, April 15, 2018

count and Len difference in Pandas

In [6]: import pandas as pd

In [7]: import numpy as np

In [8]: s = pd.Series(['a','b','c','d',np.nan])

In [9]: s.describe()
Out[9]: 
count     4
unique    4
top       c
freq      1
dtype: object

In [10]: s
Out[10]: 
0      a
1      b
2      c
3      d
4    NaN
dtype: object


In [12]: s.count(),len(s)
Out[12]: (4, 5)


No comments:

Post a Comment