我有一个非常脏的 csv,其中有几列只有空值。
我想删除它们。我正在尝试选择列中空值计数不等于行数的所有列。
clean_df = bucketed_df.select([c for c in bucketed_df.columns if count(when(isnull(c), c)) not bucketed_df.count()])
但是,我收到此错误:
SyntaxError: invalid syntax
File "<command-2213215314329625>", line 1
clean_df = bucketed_df.select([c for c in bucketed_df.columns if count(when(isnull(c), c)) not bucketed_df.count()])
^
SyntaxError: invalid syntax
如果有人可以帮助我摆脱这些脏列,那就太好了。