我在python/pyspark中有一个带有列的数据框id time city zip等等......
现在我name在这个数据框中添加了一个新列.
现在,我必须以这样的方式排列列,以便name列出来id
我在下面做了
change_cols = ['id', 'name']
cols = ([col for col in change_cols if col in df]
+ [col for col in df if col not in change_cols])
df = df[cols]
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
pyspark.sql.utils.AnalysisException: u"Reference 'id' is ambiguous, could be: id#609, id#1224.;"
Run Code Online (Sandbox Code Playgroud)
为什么会出现此错误.我怎样才能纠正这个问题.