文件流处理流式处理大数据处理
20210315
https://www.yuque.com/7125messi/wydusr/wweetn
 42-(重要重要重要)加速pandas(Modin和pandarallel)
 重點
https://zhuanlan.zhihu.com/p/65647604
 下面我們對之前使用過的原始的pandas,pandarallel以及modin進行比較(默認使用全部cpu以進行充分的比較)
 、
Modin,只需一行代碼加速你的Pandas
 https://blog.csdn.net/fengdu78/article/details/114684018
20210204
from pandas_streaming.df import StreamingDataFramesdf = StreamingDataFrame.read_df(df,chunksize=10)i=0for chunk in tqdm(sdf):tb=dh.get_vector(chunk,gsxl,sxyxl)tb=dh.convert2vec(tb)#這里追加索引沒有用的 每個塊都是重新索引if i==0:tb.to_csv('./data/vector_converted_successfully.csv',mode='a',index=False)i+=1else:tb.to_csv('./data/vector_converted_successfully.csv', mode='a', index=False, header=False)i+=1table_to_process = table_to_process[['company_a', 'company_b', 's']]table_to_process['index']=table_to_process.indextable_to_process.to_csv('./data/all_company_data_to_process.csv',index=False)
以這里為準
20210111
  for chunk in tqdm(sdf):tb=dh.get_vector(chunk,gsxl,sxyxl)tb=dh.convert2vec(tb)#這里追加索引沒有用的 每個塊都是重新索引# tb=pd.DataFrame(tb)tb.to_csv('./data/vector_converted_successfully.csv',mode='a',index=False,header=False)pandas 分塊處理的時候 每個塊是分別索引
        tb.to_csv('./data/vector_converted_successfully.csv',mode='a',index=False,header=False)
追加的時候注意把header 置為false
https://www.it1352.com/1686246.html
 numpy 追加的方式存儲
任何讀寫的方式都可以查看是否有 分塊讀取和追加的存儲方式
https://www.cnblogs.com/roygood/p/10024472.html
 Python中IO編程-StringIO和BytesIO
https://blog.51cto.com/14320361/2486142?source=dra
 https://www.imooc.com/article/267887
 python–文件流讀寫 本身 寫入方式為a 就是追加的處理方式
Pandas 讀取流式文件
 https://blog.csdn.net/chuotangbang2061/article/details/101054436
用Pandas 處理大數據的3種超級方法
 https://blog.csdn.net/blogtranslator/article/details/90714717
pandas_streaming: streaming API over pandas
 https://github.com/sdpython/pandas_streaming
https://blog.csdn.net/weixin_42575020/article/details/96968788
df_orther.to_csv('其他.csv',mode='a', index=False,header=None)
pandas 也可以直接以追加的方式存儲
df_=pd.read_csv(r"D:\code12temp\rongxiang\multilabelA\上下游匹配\產業匹配數據已處理好.csv", sep="\t", encoding="utf-8",chunksize=100)
for chunk in df_:#導出到已存在的h5文件中,這里需要指定keychunk.to_hdf(path_or_buf='./demo.h5',key='chunk_store',append=True)#創建于本地demo.h5進行IO連接的store對象
可以處理無限大的數據量
 https://blog.csdn.net/kyle1314608/article/details/112391780
 重點
利用dask替代pandas進行數據分析dask相信很多朋友都有聽說過,它的思想與上述的分塊處理其實很接近,只不過更加簡潔,且對系統資源的調度更加智能,從單機到集群,都可以輕松擴展伸縮。推薦使用conda install dask來安裝dask相關組件,安裝完成后,我們僅僅需要需要將import pandas as pd替換為import dask.dataframe as dd,其他的pandas主流API使用方式則完全兼容,幫助我們無縫地轉換代碼:https://www.cnblogs.com/feffery/p/13906821.html
 重點
總結
以上是生活随笔為你收集整理的文件流处理流式处理大数据处理的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 利用pandas读写HDF5文件
- 下一篇: 多分类 数据不平衡的处理 lightgb
