Modifying dataFrames inside a list is not working

前端 未结 3 864
别那么骄傲
别那么骄傲 2020-12-17 05:09

I have two DataFrames and I want to perform the same list of cleaning ops. I realized I can merge into one, and to everything in one pass, but I am still curios

3条回答
  •  情歌与酒
    2020-12-17 05:45

    By using pd.concat

    [x.reset_index(level=0,drop=True) for _, x in pd.concat([test_1,test_2],keys=[0,1]).dropna().groupby(level=0)]
    Out[376]: 
    [     A   B
     0  1.0  15
     1  8.0  49
     2  5.0  34
     3  6.0  44
     4  0.0  63,      A    B
     1  3.0  100
     2  6.0  200
     3  4.0  300
     4  9.0  400
     5  0.0  500]
    

提交回复
热议问题