def _normalize_dataframe(dataframe, index):
 data = dataframe[index].dropna()
 grouped = data.groupby(index, sort=False)
 counted = grouped[index].count()
 averaged = counted.mean(axis=1)
 return averaged

def _normalize_dataframe ( dataframe , index ) : data = dataframe [ index ] . dropna ( ) grouped = data . groupby ( index , sort = False ) counted = grouped [ index ] . count ( ) averaged = counted . mean ( axis = 1 ) return averaged
take a pandas dataframe and count the element present in the given columns .