Return the column name(s) for a specific value in a pandas dataframe

后端 未结 4 1355
孤独总比滥情好
孤独总比滥情好 2020-12-08 23:40

where I have found this option in other languages such as R or SQL but I am not quite sure how to go about this in Pandas.

So I have a file with 1262 columns and 1 r

4条回答
  •  醉话见心
    2020-12-08 23:45

    You can use data frame slicing and then get the columns names:

    df.ix[:,df.loc[0] == 38.15].columns
    

    output:

    Index([u'col7'], dtype='object')
    

提交回复
热议问题