I want to count number of times each values is appearing in dataframe.
Here is my dataframe - df:
df
status 1 N 2 N 3 C 4
You can use value_counts and to_dict:
print df['status'].value_counts() N 14 S 4 C 2 Name: status, dtype: int64 counts = df['status'].value_counts().to_dict() print counts {'S': 4, 'C': 2, 'N': 14}