Select columns in Pyspark Dataframe

前端 未结 6 1565
小鲜肉
小鲜肉 2021-02-03 21:45

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

6条回答
  •  情书的邮戳
    2021-02-03 22:28

    Try something like this:

    df.select([c for c in df.columns if c in ['_2','_4','_5']]).show()
    

提交回复
热议问题