Equality in Pandas DataFrames - Column Order Matters?

后端 未结 8 1993
说谎
说谎 2020-12-13 19:24

As part of a unit test, I need to test two DataFrames for equality. The order of the columns in the DataFrames is not important to me. However, it seems to matter to Panda

8条回答
  •  醉酒成梦
    2020-12-13 20:02

    have you tried using df1.equals(df2)? i think it's more reliable that df1==df2, though i'm not sure if it will resolve your issues with column order.

    http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.equals.html

提交回复
热议问题