【发布时间】:2022-06-24 00:58:36
【问题描述】:
我有以日期时间为索引的数据框,它的形状是(1.7 million rows, 50 columns),我将它保存为.csv 文件。现在我要确保数据框保存正确,没有信息丢失或丢失信息。
我的支票是:
# save original dataframe
origdf.to_csv('/blawblaw.csv')
# again import the saved dataframe, this for cross check
imdf = pd.read_csv('/blawblaw.csv')
# Check1 to see both dataframes are same
origdf.shape
Out[79]: (1776798, 50)
imdf.shape
Out[79]: (1776798, 51)
#check2
origdf['one_binarycolumn'].value_counts()
Out[]:
True 1643769
False 133029
Name: one_binarycolumn, dtype: int64
indf['one_binarycolumn'].value_counts()
Out[]:
True 1643769
False 133029
Name: one_binarycolumn, dtype: int64
我的问题是,有没有比我在这里做的更好的方法?
【问题讨论】:
标签: python pandas dataframe numpy