In this article we will discuss about the difference between size and count. We have learn some attribute in previous slides. In this section we will learn about the difference between Size and Count() function.
#Size defined as Size
counts NaNs
#Count Define as Count
does not coutn NaN
Size
does indeed count NaNs, this is actually a consequence of the fact that size
returns the size (or the length) of the object it is called on. Let us under stand with example. In this example we define a list and passed to Series, after all of this we apply attribute Size on series object and apply count function with it.
import pandas as pd
import numpy as np
list1=[np.NaN,2,3,4,1,2,3,4]
s1=pd.Series(list1)
print(s1)
print("Size",s1.size)
print("Count",s1.count())
import pandas as pd
import numpy as np
list1=[np.NaN,2,3,4,1,2,3,4]
s1=pd.Series(list1)
print("Size",s1.size)
print("Count",s1.count())
0 Comments