How do I remove a column from a dataframe using Pandas library for python?

前端 未结 1 2014
生来不讨喜
生来不讨喜 2021-01-25 12:59

Trying to remove a column from a dataframe with simple line of code using panda for python.

The name of the column that i\'m trying to remove is "Comments"

相关标签:
1条回答
  • 2021-01-25 13:11

    Here are 2 possible ways:-

    First Way:-

     travelTime_df.drop(['Comments'], axis=1)
    

    Second way:-

    travelTime_df.drop(columns=['Comments'])
    

    Adding link for deep dive:- https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html

    0 讨论(0)
提交回复
热议问题