My first question on StackOverflow. Please be good to me :)
Hello, I just started a small project on data science and I wanted to ultimately create a pie chart via matplot showing the percentage of device model on the site's overall traffic (i.e. 30% iPhone, 20% iPad, 10% Mac, etc.).
useragent count
iPhone 11298
Mac 3206
iPad 627
SM-N960F 433
SM-N950F 430
... ...
K330 1
K220 1
SM-J737P 1
SM-J737T1 1
0PFJ50 1
[1991 rows x 2 columns]
From the screenshot, there are 1,991 records. I am preparing the data for plotting and I want to only display the top 5 useragents (top 4 being the devices and the top 5 will be labeled as others and the sum of the remaining items).
The expected output is like this:
useragent count
iPhone 11298
Mac 3206
iPad 627
SM-N960F 433
Others 9000
Thank you so much!