如何在Panda包含列表的列中创建更多行?

时间:2019-07-03 14:56:15

标签: python python-3.x pandas

  id     info     response          state       amount

   1      [1,2]    [yes,no]          [tx,ny]    10
   2      [3]      [maybe]           [ca]       20
   3      [3,5,6]  [yes, maybe, no]  [tx,ny,ca] 30

如何将上面数据的pandas df转换为下面的数据?

    id     info     response          state   amount

    1      1        yes                tx     10
    2      2        no                 ny     10
    3      3        maybe              cal    20
    4      3        yes                tx     30
    5      5        maybe              ny     30
    6      6        no                 ca     30

0 个答案:

没有答案