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
Post a Comment