python del vs pandas drop

后端 未结 4 2224
孤街浪徒
孤街浪徒 2021-02-13 05:45

I know it might be old debate, but out of pandas.drop and python del function which is better in terms of performance over large dataset?

I am

4条回答
  •  灰色年华
    2021-02-13 05:58

    Summarizing a few points about functionality:

    • drop operates on both columns and rows; del operates on column only.
    • drop can operate on multiple items at a time; del operates only on one at a time.
    • drop can operate in-place or return a copy; del is an in-place operation only.

    The documentation at https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html has more details on drop's features.

提交回复
热议问题