Delete column from pandas DataFrame

后端 未结 17 1574
一生所求
一生所求 2020-11-22 02:44

When deleting a column in a DataFrame I use:

del df[\'column_name\']

And this works great. Why can\'t I use the following?

         


        
17条回答
  •  执念已碎
    2020-11-22 03:28

    The dot syntax works in JavaScript, but not in Python.

    • Python: del df['column_name']
    • JavaScript: del df['column_name'] or del df.column_name

提交回复
热议问题