Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
pandas Series オブジェクトの特定の値のラベルを取得するにはどうすればよいですか?
例えば:
labels = ['a', 'b', 'c', 'd', 'e'] s = Series (arange(5) * 4 , labels)
シリーズを生成するもの:
a 0 b 4 c 8 d 12 e 16 dtype: int64
値「12」のラベルを取得するにはどうすればよいですか? ありがとう
サブシリーズは次の方法で取得できます。
In [90]: s[s==12] Out[90]: d 12 dtype: int64
さらに、これらのラベルは次の方法で取得できます
In [91]: s[s==12].index Out[91]: Index([d], dtype=object)