2016-12-18

Python - How to tabulate list item occurrence frequencies (histogram), equivalent to R's table function

import pandas as p
pythonList = ['banana','apple','banana','pear','banana','pineapple','apple']
pandasDataFrame = p.DataFrame( pythonList , columns=(['Fruit Name']) )
pandasSeries = pandasDataFrame.groupby(['Fruit Name']).size()
print pandasSeries

No comments:

Post a Comment