Python Pandas Only Compare Identically Labeled DataFrame Objects

后端 未结 3 960
独厮守ぢ
独厮守ぢ 2021-01-12 15:13

I tried all the solutions here: Pandas "Can only compare identically-labeled DataFrame objects" error

Didn\'t work for me. Here\'s what I\'ve got. I hav

3条回答
  •  心在旅途
    2021-01-12 15:52

    If you want to compare 2 Data Frames. Check-out flexible comparison in Pandas, using the methods like .eq(), .nq(), gt() and more... --> equal, not equal and greater then.

    Example:

    df['new_col'] = df.gt(df_1)

    http://pandas.pydata.org/pandas-docs/stable/basics.html#flexible-comparisons

提交回复
热议问题