from itertools import islice
N = 1000000 #每次读入100w行
with open( 'your_File_path','r') as f:
while True:
next_n_lines = list(islice(f,N))
if not next_n_lines: break
#print(str(next_n_lines))
#将每次读入的n行记录转换成DataFrame处理
next_n_lines="".join(next_n_lines)
TESTDATA = StringIO(next_n_lines)
df = pd.read_csv(TESTDATA, sep="\t",header=None,names=['col_1','col_2','col_Name'],dtype=str)
print(df)
time.sleep(1)
网友评论