How to delete columns in pyspark dataframe

前端 未结 8 1553
滥情空心
滥情空心 2021-01-30 01:55
>>> a
DataFrame[id: bigint, julian_date: string, user_id: bigint]
>>> b
DataFrame[id: bigint, quan_created_money: decimal(10,0), quan_created_cnt: bigi         


        
8条回答
  •  余生分开走
    2021-01-30 02:36

    You can delete column like this:

    df.drop("column Name).columns
    

    In your case :

    df.drop("id").columns
    

    If you want to drop more than one column you can do:

    dfWithLongColName.drop("ORIGIN_COUNTRY_NAME", "DEST_COUNTRY_NAME")
    

提交回复
热议问题