Python Pandas to_csv是否有最大行数?

2024-10-01 11:29:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将文本文件导出到csv。该文件是非常大(160万行)制表符分隔的文件。当我使用toucv导出文件时,它只导出1048576行。是否有最大数量的行可以导出到\csv?在

我应该以不同的方式导出数据吗?我真的很希望能把它变成一个csv。在

下面是我的代码示例。在

import pandas as pd
import numpy as np
import os

from pandas import Series, DataFrame

pathDataEDM = "C:/Users/FILE.txt"

dataEDM = pd.read_csv(pathDataEDM, sep="\t")

dataEDM.to_csv(os.path.join(ExportDir),index=False)

Tags: 文件csv数据importpandas数量osas
1条回答
网友
1楼 · 发布于 2024-10-01 11:29:59

我不认为有一个最大值(因为它没有记录,160万是相当低的最高值)。在

您可以尝试指定以下可选参数(请参见docs):

chunksize : int or None rows to write at a time

compression : string, optional a string representing the compression to use in the output file, allowed values are ‘gzip’, ‘bz2’, ‘xz’, only used when the first argument is a filename

相关问题 更多 >