繁体   English   中英

如何使用 python 仅选择我需要的列

[英]How do I pick only the column I require using python

ml = MonkeyLearn('2d14ec2555abc7f9e2aefee982e212d9091e310a')
data = ['I am excellent']
result = ml.classifiers.classify(model_id, data)
t = result.body[0]
print(t)

{'text': 'Good', 'external_id': None, 'error': False, 'classifications': [{'tag_name': 'Positive', 'tag_id': 122921383, 'confidence': 0.983}]} 

我在数组数组中有一个列表,如何从该数据中仅删除“分类”列,该数据在数组中,我只想要所需的 output:

Classification : Tag_name : Positive 
                 Confidence : 0.983

您可以使用此代码 -

t = {'text': 'Good', 'external_id': None, 'error': False, 'classifications': [{'tag_name': 'Positive', 'tag_id': 122921383, 'confidence': 0.983}]}
classifications = t['classifications']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM