【发布时间】:2021-12-23 05:42:35
【问题描述】:
我在数据框的一列中有这样的列表:
list1 = [[Petitioner Jae Lee,his,he],[]]
list2 = [[lee],[federal officials]]
list3 = [[],[lawyer]]
但我想变成
list1 = ['Petitioner Jae Lee' , 'his','he']
list2 = ['lee' , 'federal officials']]
list3 = ['lawyer']
我想为数据框中的列执行此操作。我该怎么做?
【问题讨论】:
-
你是如何读取这些数据的?当前的 Pandas 很可能已经默认将其作为字符串引入。在解决不应该成为问题的问题之前,您可能想回到起点。
标签: pandas list dataframe for-loop