Answers for "sub select drop pandas"

3

pandas dataframe delete column

del df['column_name']
Posted by: Guest on June-29-2020
0

Returns a new DataFrame that drops the specified column

# Returns a new DataFrame that drops the specified column

df.drop('age').collect()
# [Row(name='Alice'), Row(name='Bob')]

df.drop(df.age).collect()
# [Row(name='Alice'), Row(name='Bob')]

df.join(df2, df.name == df2.name, 'inner').drop(df.name).collect()
# [Row(age=5, height=85, name='Bob')]

df.join(df2, df.name == df2.name, 'inner').drop(df2.name).collect()
# [Row(age=5, name='Bob', height=85)]

df.join(df2, 'name', 'inner').drop('age', 'height').collect()
# [Row(name='Bob')]
Posted by: Guest on April-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language