1. 程式人生 > >python快速讀取大資料1

python快速讀取大資料1

 1 rd = pd.read_csv(path7 + u'0501-0914.csv',encoding = 'gbk',iterator = True)
 2 loop =True
 3 dflst = []
 4 i = 0
 5 while loop:
 6     try:
 7         i+=1
 8         df0 = rd.get_chunk(50000)
 9         dflst.append(df0)
10     except StopIteration:
11         loop = False
12 #        print 'stop'
13 df = pd.concat(dflst,ignore_index =True)