0

I'm new to Python. I would like to ask regarding how can you delete a specific columns in a pandas dataframe. This is my dataframe:

Pandas Dataframe:

Pandas Dataframe

I would like to delete the column "tahun" and "jenis" as its have the same value for every month. Please help.

Vitalizzare
  • 4,496
  • 7
  • 13
  • 32
Cyno
  • 11
  • 3
  • 3
    Does this answer your question? [Delete a column from a Pandas DataFrame](https://stackoverflow.com/questions/13411544/delete-a-column-from-a-pandas-dataframe) – psarka May 29 '22 at 09:09

1 Answers1

0
df.drop(columns=['tahun','jenis'], inplace=True)
Naveed
  • 11,495
  • 2
  • 14
  • 21
  • 1
    Can you specify what does inplace do? – Cyno May 29 '22 at 09:13
  • 'inplace' updates the df but will not have the dropped columns. Alternate of it is to assign it to another df. Try out with and without 'inplace' to see the difference – Naveed May 29 '22 at 09:15