1 | initial version |
You can drop the column using the drop()
method in Pandas. Here is an example:
import pandas as pd
# create a sample dataframe
df = pd.DataFrame({
'A': [1, 2, 3],
'B': [4, 5, 6],
'C': [7, 8, 9]
})
# drop column 'C'
df = df.drop('C', axis=1)
# view the dataframe without column 'C'
print(df)
In this example, we are dropping the column 'C' using the drop()
method with the axis=1
parameter. The resulting dataframe will no longer have the 'C' column. You can replace 'C' with the name of the column that you want to drop in your own dataframe.