Search code examples
pyspark

Invalid syntax. Perhaps you forgot a comma?


I'm trying to do a very simple operation, I join 2 dataframes and then select all columns from first and only few columns from second one

col_list = ['price', 'total'] 
out = out.join(table, on=['ID1', 'ID2']).select(out['*'], table[*col_list]) 

Then it gives error inside the select, at the start of , table[*col_list]

SyntaxError: invalid syntax. Perhaps you forgot a comma?

What was the wrong syntax here I don't really get this error?


Solution

  • col_list = ['price', 'total'] 
    out = out.join(table, on=['ID1', 'ID2']).select(*out.columns,*col_list)