[英]pandas.DataFrame.loc gives output for a label twice and mentions Name and dtype
I have a pandas DataFrame indexed by item_id (numbers), I tried to access an item at a location by using DataFrame.loc[str(item_id),word]
where word is the label of the column I want to access. 我有一个由item_id(数字)索引的熊猫DataFrame,我尝试通过使用
DataFrame.loc[str(item_id),word]
访问某个位置的项目,其中word是我要访问的列的标签。 Word is a string: Word是一个字符串:
print(output.loc[str(df.loc[i,'item_id']),word])
The output I get is the following: 我得到的输出如下:
hu 0.0
hu 0.0
Name: 17349826, dtype: float64
here word has value hu
and item_id
had 17349826
. 这里的单词具有
hu
值, item_id
具有17349826
。
I want the output as just: 我希望输出为:
0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.