Skip to content

Instantly share code, notes, and snippets.

@nikparmar
Created March 9, 2017 05:30
Show Gist options
  • Save nikparmar/28e5dde22203beadf7aea967be01e7d3 to your computer and use it in GitHub Desktop.
Save nikparmar/28e5dde22203beadf7aea967be01e7d3 to your computer and use it in GitHub Desktop.
[{'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Mobile Web (M5)'}, {'count': 1, 'type': u'Mobile Web (M5)'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Hootsuite'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter Web Client'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Instagram'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Twitter for iPhone'}, {'count': 1, 'type': u'Paper.li'}, {'count': 1, 'type': u'Paper.li'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Paper.li'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}, {'count': 1, 'type': u'Twitter for Android'}]
@puneetjindal
Copy link

import pandas as pd
x_list = [{},{}.....]
output = pd.DataFrame(x_list,columns = ['type','count']).groupby('type').agg({'count':'sum'})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment