-2

I was wondering if someone could direct me to some documentation on what the *[ ... ] does in this example of converting columns to lowercase in a pyspark dataframe

df.toDF(*[c.lower() for c in df.columns])
jonrsharpe
  • 107,083
  • 22
  • 201
  • 376

1 Answers1

0

The [c.lower() for c in df.columns] construct will create an array with the columns converted to lowercase, and the * in front of the array means that the array elements will be sent as individual arguments to df.toDF(). E.g. if the array is a=[1,2,"b"] then df.toDF(*a) is equivalent to df.toDF(1,2,"b").

tif
  • 1,304
  • 8
  • 14