1
如果我用下面的代碼我得到這個異常:獲取int()函數的參數必須是字符串或數字,而不是「Column'-阿帕奇星火
int() argument must be a string or a number, not 'Column'
df= df.withColumn('FY',
F.when((df['ID'].substr(5,2).isin({'11','12'})),int(df['ID'].substr(1,4))+1).
otherwise(int(df['ID'].substr(1,4))))
基本上如果結果是11或12,我想給結果加1,否則就是ID。請幫助,我對Python相當陌生。
真棒!該作品謝謝! –