returns a new dataframe that drops the specified column

Solutions on MaxInterview for returns a new dataframe that drops the specified column by the best coders in the world

showing results for - "returns a new dataframe that drops the specified column"
Miguel Ángel
30 Sep 2020
1# Returns a new DataFrame that drops the specified column
2
3df.drop('age').collect()
4# [Row(name='Alice'), Row(name='Bob')]
5
6df.drop(df.age).collect()
7# [Row(name='Alice'), Row(name='Bob')]
8
9df.join(df2, df.name == df2.name, 'inner').drop(df.name).collect()
10# [Row(age=5, height=85, name='Bob')]
11
12df.join(df2, df.name == df2.name, 'inner').drop(df2.name).collect()
13# [Row(age=5, name='Bob', height=85)]
14
15df.join(df2, 'name', 'inner').drop('age', 'height').collect()
16# [Row(name='Bob')]