How to exclude multiple columns in Spark dataframe in Python

后端 未结 3 1411
一整个雨季
一整个雨季 2020-12-03 00:46

I found PySpark has a method called drop but it seems it can only drop one column at a time. Any ideas about how to drop multiple columns at the same time?

3条回答
  •  离开以前
    2020-12-03 01:30

    The right way to do this is:

    df.drop(*['col1', 'col2', 'col3'])

    The * needs to come outside of the brackets if there are multiple columns to drop.

提交回复
热议问题