Counter to df pandas

Do you want to know the details about “Counter to df pandas”. If yes, you’re in the correct article.

Counter to df pandas

len(df[df['score'] == 1.0])
from collections import Counter
d = Counter('fb_view_listing': 76, 'fb_homescreen': 63, 'rt_view_listing': 50, 'rt_home_start_app': 46, 'fb_view_wishlist': 39, 'fb_view_product': 37, 'fb_search': 29, 'rt_view_product': 23, 'fb_view_cart': 22, 'rt_search': 12, 'rt_view_cart': 12, 'add_to_cart': 2, 'create_campaign': 1, 'fb_connect': 1, 'sale': 1, 'guest_sale': 1, 'remove_from_cart': 1, 'rt_transaction_confirmation': 1, 'login': 1)
df = pd.DataFrame.from_dict(d, orient="index").reset_index()
>>> df.set_index(["Person", "Single"]).count(level="Person")
John      2
Lewis     1
Myla      1


I hope this post helps you to know about “Counter to df pandas”. If you have any queries regarding this article please let us know via the comment section. Share this post with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment