I am looking for a way to select columns of my dataframe in pyspark. For the first row, I know I can use df.first() but not sure about columns given that they do
df.first()
Try something like this:
df.select([c for c in df.columns if c in ['_2','_4','_5']]).show()