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])
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])
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")
.