简体   繁体   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}]} 

I have a List in array Array, how can i remove only 'classification' column from this data, This data is in array and I want only the Desired output:我在数组数组中有一个列表,如何从该数据中仅删除“分类”列,该数据在数组中,我只想要所需的 output:

Classification : Tag_name : Positive 
                 Confidence : 0.983

You can use this code -您可以使用此代码 -

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.

相关问题 如何修改我在python中随机选择的网址 - how do I modify a url that I pick at random in python 仅当使用 Python 和 Faker 的上一列中存在某个值时,如何将数据添加到列中? - How do I add data to a column only if a certain value exists in previous column using Python and Faker? 我如何从列表中随机选择用户要求在 python 中使用输入的次数? - how do i randomly pick characters out of a list the amount of times the user asks for using input in python? 如何选择与 python 中特定文件夹相关的文件? - How do I pick files with respect to a particular folder in python? 如何在 python 中的两个数字之间随机选择,但有例外? - How do I randomly pick between 2 numbers in python with exceptions? 如何在python中编写for循环以仅从csv文件中提取唯一值以加载到我的API脚本中? - How do I write a for loop in python to pick up only unique values from a csv file to load into my API script? 如何使用 python 从字典列表中选择值 - How can I pick the value from list of dicts using python 如何使用 Pandas 将变量分配给 Python 中的列 - How do I assign a variable to a column in Python using Pandas 使用Python,如何仅将不同的消息添加到列表? - Using Python, how do I add only distinct messages to a list? 如何使用python将列添加到现有excel文件? - How do I add a column to an existing excel file using python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM