[英]How can I split out this list containing a dictionary into separate columns?
It would have been nice if you provided a code snippet for this since we are unable to easily test your case.如果您为此提供代码片段会很好,因为我们无法轻松测试您的案例。
The following lines should do the job:以下几行应该可以完成这项工作:
df['label'] = df['sentiment'].apply(lambda x: x[0]['label'])
df['score'] = df['sentiment'].apply(lambda x: x[0]['score'])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.