Professional Documents
Culture Documents
03 - Introduction To Pandas 6
03 - Introduction To Pandas 6
03 - Introduction To Pandas 6
# often then case that we 'catch' this in another variable, leaving the original unchanged
x = df.drop('b')
x = df.drop(['b','c'])
x = df.drop('two', axis=1)
# or more descriptively
x = df.drop('two', axis='columns')
x = df.pop('two')
df
# very unforgiving
del df['three']
df
Appending Columns
very easy to accomplish
E.g. To add a column populated with data to the end of your DataFrame
df['NAME OF COLUMN'] = data
if the column already exists, it will overwrite the values in the existing column
df['five'] = 5
df
Inserting Columns
Insert a column into the Google DataFrame between the 'Close' column and the 'Volume' column.