[英]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.