I need help with this simple piece of code (pyspark):
def ann(table):
table=table.withColumn('stand', lit('29Jan2020'))
for table in [akt_test, b60_test, db71_test, pek6_test, db00f_test, d23b_test, bw0110_test]:
ann(table)
So I only try to add the column "stand" to all (already existing) dataframes from the list. Unfortunately the column is not added. Strangely, if i add a command "print(table.columns)" at the end of the function "ann", I see the new column there. But not in the actual data frames.
If i simply take one data frame and write
akt_test=akt_test.withColumn('stand', lit('29Jan2020'))
everythings works fine. But not in a loop. I don't understand why and how I can heal it. Thanks in advance for Your ideas.