Select before aggregate with Pandas, python -


i'm pretty new pandas in python , need see if i'm doing right. have excel file containing data , i'm using pandas play data. question mentions can select 4 ports before aggregating in terms of year , ports. tried this.

filterport = porttraffic.port.isin(['adelaide','brisbane','sydney','melbourne'])            new = porttraffic[filterport] year_port = new.groupby(['year','port']) 

i obtain output (if print head) showing me data of 4 ports filtered wonder if i'm doing correctly?

note, porttraffic excel file


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -