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

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -