【发布时间】:2016-07-13 01:48:24
【问题描述】:
我有一个大约 500000 行的 Pandas DataFrame,格式如下:
**ID Name Tags**
4345 Bill {'circle:blue', 'background:orange', 'Type':12}
为了更直接的数据分析,我想转换为:
**ID Name Key Value**
4345 Bill Circle Blue
4345 Bill Background Orange
4345 Bill Type 12
我找到了一个可以每行拆分一个键/值的答案: Python Pandas: How to split a sorted dictionary in a column of a dataframe,但我很遗憾地未能扩展它来执行我的上述要求。
我或许可以使用一些标准循环来处理这个问题,但我希望有一种优雅高效的 Pandas 方法?
【问题讨论】:
标签: python dictionary pandas