I have a 27 GB CSV file and I just want to rename the header lines. Can I do this without reading the entire file in a data framework and then writing the entire file again?
This is essentially what I want to do, but without re-writing the entire 27 gigabyte file.
data = pd.read_csv(filename,sep="|",nrows=2)
data.head()
LOC_ID UPC FW BOP_U BOP_$
0 17 438531560821 201712 1 40.0
1 239 438550152328 201719 2 28.8
data.columns = ['WHSE','SKU','PERIOD','QUANTITYONHAND','DOLLARSONHAND']
data.head()
WHSE SKU PERIOD QUANTITYONHAND DOLLARSONHAND
0 17 438531560821 201712 1 40.0
1 239 438550152328 201719 2 28.8
source
share