Introduction
Series
What DataFrames are
DataFrame columns
16. Removing a column
DataFrame rows
Filtering rows and columns
Filtering data frames
Sorting rows
Summary

Instruction

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.

Exercise

Remove the GDP Per Capita column from eu_states.

Stuck? Here's a hint!

Use:

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