Pandas concat: ValueError: Shape of passed values is blah, indices imply blah2

前端 未结 7 998
梦如初夏
梦如初夏 2020-11-27 16:41

I\'m trying to merge a (Pandas 14.1) dataframe and a series. The series should form a new column, with some NAs (since the index values of the series are a subset of the ind

7条回答
  •  孤独总比滥情好
    2020-11-27 17:15

    My problem were different indices, the following code solved my problem.

    df1.reset_index(drop=True, inplace=True)
    df2.reset_index(drop=True, inplace=True)
    df = pd.concat([df1, df2], axis=1)
    

提交回复
热议问题