怎么删除pyspark dataframe中的某一列?
3个回答
也可以一次性删除多个列
cols_to_drop = ['c1', 'c2', 'c3', 'c4']
df = df.drop(*cols_to_drop)
SofaSofa数据科学社区DS面试题库 DS面经drop_list = ['col1', 'col2', ...]
df = df.select([col for col in df.columns if col not in drop_list])
怎么删除pyspark dataframe中的某一列?
也可以一次性删除多个列
cols_to_drop = ['c1', 'c2', 'c3', 'c4']
df = df.drop(*cols_to_drop)
SofaSofa数据科学社区DS面试题库 DS面经drop_list = ['col1', 'col2', ...]
df = df.select([col for col in df.columns if col not in drop_list])