python - How to get the last chunk of a csv file using Pandas? -
suppose have csv file containing 5 rows.
now iterate on file using chunksize of 2.
data = pd.read_csv(data_name, header=none, iterator=true, chunksize=2)
suppose doing magic on data chunk , appending csv file.
processed_data.to_csv(fname, index=none, mode="a")
problem: last row not written.
i not know how solve problem. can help?
i need use chunks because don't have enough ram.
i can not use chunksize=1
, because opening/closing file time consuming.
if running out of memory use blaze type of data. https://blaze.readthedocs.io/en/latest/ooc.html
then don't have mess chunksize.
Comments
Post a Comment