【发布时间】:2019-10-25 11:27:53
【问题描述】:
我有一个可以使用下面给出的代码创建的数据框
df = pd.DataFrame({'Person_id':[1,2,3,4],
'Values':['father:1.Yes 2.No 3.Do not Know','Mother:1.Yes 777.No 999.Do not
Know','sons:1.Yes 2.No 321.Do not Know','daughter:1.Yes 567.No 3.Do not Know'],
'Ethnicity':['dffather','dfmother','dfson','dfdaughter']})
上面的代码生成如下所示的数据帧
我想将数据框中每一行的内容拆分为单独的一行
我怎样才能得到这样的输出?
【问题讨论】:
标签: python regex python-3.x pandas dataframe