我有一个dataframe,其中所有的值都作为数组存储在其中一列中。
我想使用这个数组并执行以下操作:
我有一个数据帧,看起来像这样:
group email
0 c 'samuel.tom@example.com / samuel tom\rkate.leo@example.com / kate leo\rbilly.billerson@example.com',nan
df["email"].values
,我看到了以下内容:
array(['samuel.tom@example.com / samuel tom\rkate.leo@example.com / kate leo\rbilly.billerson@example.com',nan], dtype=object
我需要做的是制作以下内容:
group email
0 c samuel.tom@example.com / samuel tom
0 c kate.leo@example.com / kate leo
0 c billy.billerson@example.com
0 c nan
我发现了另一篇文章,它解释了如何垂直分割值,而且它是有效的,只是不适用于这种特殊情况。
认为
我需要做的是将数组转换成一个列表,从这个新值中删除所有回车符,然后垂直拆分所有内容。
我尝试通过以下操作将值转换为列表:
open_appended_file["Members"] = open_appended_file["Members"].tolist()
有什么建议吗?