Dataframe metadata

import pandas as pd # Create data frame from csv file df=pd.read_csv(“e://data/state-population.csv”) #Meta data about data frame df.info() Output <class ‘pandas.core.frame.DataFrame’> RangeIndex: 2544 entries, 0 to 2543 Data columns (total 4 columns): state/region 2544 non-null object ages 2544 non-null object year 2544 non-null int64 population 2524 non-null float64 dtypes: float64(1), int64(1), object(2) memory usage: 79.6+Continue reading “Dataframe metadata”

Dataframe condition

import pandas as pd # Create data frame from csv file df=pd.read_csv(“e://data/state-population.csv”) # data retrieval for year 2013 (First 5 rows) print(df[df.year==2013].head()) Output      state/region ages year population 8    AL under18 2013 1111481.0 9    AL total 2013 4833722.0 86   AK under18 2013 188132.0 87   AK total 2013 735132.0 102 AZ under18 2013Continue reading “Dataframe condition”