Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
What DataFrames are
DataFrame columns
16. Removing a column
DataFrame rows
Filtering rows and columns
Filtering data frames
Sorting rows


Great. To remove a column, use data_frame.drop():

hospitals.drop('Full City', axis = 1)

The drop() function takes two arguments: the name of the column to remove, and the information about the axis. In pandas DataFrames, axis = 0 means rows, and axis = 1 means columns. Here, we want to get rid of a column, so we use axis = 1.

Removing columns from a DataFrame is not very common in data analysis. Still, it's good to know how to do it.


Remove the GDP Per Capita column from eu_states.

Stuck? Here's a hint!


eu_states.drop('GDP Per Capita',axis=1)