如何在python中阅读和转换13gbit文本?



我有一个1.5 gbit的rar文件,当我打开它时,它给了我13 gbit的。txt文件,我无法加载任何东西。我使用:

import pandas as pd
read_file = pd.read_csv (r'Path where the Text file is storedFile name.txt', sep='t')
read_file.to_csv (r'Path where the CSV will be savedFile name.csv', index=None)

我在Pycharm中使用了它,它会永远占用

MemoryError

我用colab在它崩溃了,我想这是因为我的驱动器几乎满了,因为我只有15G的驱动器。我该怎么办?

chunksize参数指定每个块的行数。

chunksize = 10 ** 6
with pd.read_csv(filename, chunksize=chunksize, on_bad_lines='skip') as reader:
for chunk in reader:
# you can use chunk to process the data in parts

最新更新