我有一些数据是这种形式:
a = [{'table': 'a', 'field':['apple', 'pear']},
{'table': 'b', 'field':['grape', 'berry']}]
我想创建一个看起来像这样的数据框:
```html
我要创建一个数据框,它长这样:
``` field table
0 apple a
1 pear a
2 grape b
3 berry b
当我尝试这样做时:
pd.DataFrame.from_records(a)
I get this:
field table
0 [apple, pear] a
1 [grape, berry] b
我正在使用循环来重构我的原始数据,但我认为一定有更加简单直接的方法。
berry c
?它不应该是b
吗? - umutto