我正在尝试处理一些CSV数据,通常我会在有复杂更改时使用pandas。但是,我不知道如何处理一个或多个CSV字段中的嵌套键值
所以本质上我有这样的数据
+------+------+-------------------+------+------+
| col1 | col2 | col3 | col4 | col5 |
+------+------+-------------------+------+------+
| v | v | ncol1=nv,ncol2=nv | v | v |
+------+------+-------------------+------+------+
| v | v | ncol3=nv | v | v |
+------+------+-------------------+------+------+
| v | v | | v | v |
+------+------+-------------------+------+------+
我试着得到这样的东西
+------+------+-------+-------+-------+------+------+
| col1 | col2 | ncol1 | ncol2 | ncol3 | col4 | col5 |
+------+------+-------+-------+-------+------+------+
| v | v | nv | nv | | v | v |
+------+------+-------+-------+-------+------+------+
| v | v | | | nv | v | v |
+------+------+-------+-------+-------+------+------+
| v | v | | | | v | v |
+------+------+-------+-------+-------+------+------+
假设列
C
中的数据帧值是逗号分隔的字符串,代码执行以下操作C
中存在的所有空值行/空行,以便可以扩展以前创建的dictionary对象请注意,删除
C
列只是为了使输出与提供的示例输出匹配相关问题 更多 >
编程相关推荐