Created
June 11, 2020 10:27
-
-
Save kovid-r/69766cfc6d8c69a9a6500e4b960044bc to your computer and use it in GitHub Desktop.
Drop columns from a DataFrame PySpark Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove a column from a DataFrame | |
df.drop('this_column') | |
# Remove multiple columns in a go | |
drop_columns = ['this_column', 'that_column'] | |
df.select([col for col in df.columns if column not in drop_columns]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment