gpt4 book ai didi

python - 在 pandas 系列中按值搜索

转载 作者:太空宇宙 更新时间:2023-11-03 15:08:07 25 4
gpt4 key购买 nike

给个pandas系列

(Pdb) type(dt.ix['some name'])
<class 'pandas.core.series.Series'>

(Pdb) df.ix['some name']
col1 5
col2 31
col3 3
col4 12

Name: some name, dtype: int64

如何找到具有值(例如 31)的列的名称?在本例中,它是 col2

最佳答案

myseries[myseries  == 'VALUE'].index.tolist() 

关于python - 在 pandas 系列中按值搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30339923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com