Check out example codes for "how to value counts of two columns in pandas". It will help you in understanding the concepts better.

Code Example 1

df = pd.DataFrame({'a':list('abssbab')})
df.groupby('a').count()

Code Example 2

# importing pandas as pd 
import pandas as pd 
  
# sample dataframe 
df = pd.DataFrame({ 'A': ['foo', 'bar', 'g2g', 'g2g', 'g2g', 
                                'bar', 'bar', 'foo', 'bar'], 
                   'B': ['a', 'b', 'a', 'b', 'b', 'b', 'a', 'a', 'b'] }) 
  
# Multi-column frequency count 
count = df.groupby(['A']).count() 
print(count)

Code Example 3

# importing pandas as pd 
import pandas as pd 
  
# sample dataframe 
df = pd.DataFrame({'A': ['foo', 'bar', 'g2g', 'g2g', 'g2g', 
                         'bar', 'bar', 'foo', 'bar'], 
                  'B': ['a', 'b', 'a', 'b', 'b', 'b', 'a', 'a', 'b'] }) 
  
# frequency count of column A 
count = df['A'].value_counts() 
print(count)

Learn ReactJs, React Native from akashmittal.com