manipulating data frames often data encoded in dataframe or series objects need to be extractedalteredor combined gettingsettingand deleting columns works in similar manner as for dictionaries the following code illustrates various operations ages [ , , , , , , , ='gender ':[' '' ']* 'age 'agesdf pd dataframe (ddf at[ ,'age '] change an element df at[ ,'gender ''female change another element df df drop('age , drop column df df copy ()create separate copy of df df ['age 'ages add the original column dfcomb pd concat ([df ,df ,df ],axis = combine the three dfs print dfcomb gender female age gender female gender female age note that the above dataframe object has two age columns the expression dfcomb['age'will return dataframe with both these columns table useful pandas methods for data manipulation agg aggregate the data using one or more functions apply apply function to column or row astype change the data type of variable concat concatenate data objects replace find and replace values read_csv read csv file into dataframe sort_values sort by values along rows or columns stack stack dataframe to_excel write dataframe to an excel file it is important to correctly specify the data type of variable before embarking on data summarization and visualization tasksas python may treat different types of objects in dissimilar ways common data types for entries in dataframe object are floatcategorydatetimebooland int generic object type is object ='gender ':[' '' '' ']* 'age '[ , , , , , , , , , , , ]df=pd dataframe (dprint (df dtypes df['gender 'df['gender 'astype ('category 'change the type print (df dtypes