考虑唯一性 pd.Index
idx
和索引列表lst
idx = pd.Index(list('abcdefg'))
lst = list('bdf')
我们可以得到'b'
by的序数位置idx.get_loc('b')
。
我们如何lst
有效地获得所有物品的序数位置?
idx.get_loc(lst)
不起作用:
TypeError: '['b', 'd', 'f']' is an invalid key
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句