df1.equals(df2)在熊猫中的同一csv文件上失败

时间:2018-07-02 09:28:52

标签: python pandas dataframe

我有两个数据帧df1和df2,它们必须相等,如以下代码所示:

df1.to_csv("part2_trains.csv",index=False)
df2= pd.read_csv("part2_trains.csv",index_col=False)
print df2.dtypes
print df1.dtypes
print df1.equals(df2)

但是这不是我期望的输出:

hour_id                  int64
device_id                int64
os_id                    int64
browser_id               int64
first_category_name     object
city                    object
state_code              object
referer                 object
dow                     object
mobile_model            object
screen_size             object
impression               int64
revenue                float64
dtype: object
hour_id                  int64
device_id                int64
os_id                    int64
browser_id               int64
first_category_name     object
city                    object
state_code              object
referer                 object
dow                     object
mobile_model            object
screen_size             object
impression               int64
revenue                float64
dtype: object
False

为什么df1.equals(df2)尽管是同一东西却返回False?

0 个答案:

没有答案