久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='BHqZZ'></small><noframes id='BHqZZ'>

      <bdo id='BHqZZ'></bdo><ul id='BHqZZ'></ul>

      <legend id='BHqZZ'><style id='BHqZZ'><dir id='BHqZZ'><q id='BHqZZ'></q></dir></style></legend>
    1. <tfoot id='BHqZZ'></tfoot>
      1. <i id='BHqZZ'><tr id='BHqZZ'><dt id='BHqZZ'><q id='BHqZZ'><span id='BHqZZ'><b id='BHqZZ'><form id='BHqZZ'><ins id='BHqZZ'></ins><ul id='BHqZZ'></ul><sub id='BHqZZ'></sub></form><legend id='BHqZZ'></legend><bdo id='BHqZZ'><pre id='BHqZZ'><center id='BHqZZ'></center></pre></bdo></b><th id='BHqZZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BHqZZ'><tfoot id='BHqZZ'></tfoot><dl id='BHqZZ'><fieldset id='BHqZZ'></fieldset></dl></div>

        在 Pandas 中使用多處理讀取 csv 文件的最簡單方法

        Easiest way to read csv files with multiprocessing in Pandas(在 Pandas 中使用多處理讀取 csv 文件的最簡單方法)

        1. <i id='2vZX6'><tr id='2vZX6'><dt id='2vZX6'><q id='2vZX6'><span id='2vZX6'><b id='2vZX6'><form id='2vZX6'><ins id='2vZX6'></ins><ul id='2vZX6'></ul><sub id='2vZX6'></sub></form><legend id='2vZX6'></legend><bdo id='2vZX6'><pre id='2vZX6'><center id='2vZX6'></center></pre></bdo></b><th id='2vZX6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2vZX6'><tfoot id='2vZX6'></tfoot><dl id='2vZX6'><fieldset id='2vZX6'></fieldset></dl></div>
          <legend id='2vZX6'><style id='2vZX6'><dir id='2vZX6'><q id='2vZX6'></q></dir></style></legend>
            <tbody id='2vZX6'></tbody>
        2. <small id='2vZX6'></small><noframes id='2vZX6'>

                  <bdo id='2vZX6'></bdo><ul id='2vZX6'></ul>
                • <tfoot id='2vZX6'></tfoot>
                  本文介紹了在 Pandas 中使用多處理讀取 csv 文件的最簡單方法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  這是我的問題.
                  帶有一堆 .csv 文件(或其他文件).Pandas 是一種讀取它們并保存為 Dataframe 格式的簡單方法.但是當文件量很大時,我想通過多處理讀取文件以節省一些時間.

                  Here is my question.
                  With bunch of .csv files(or other files). Pandas is an easy way to read them and save into Dataframe format. But when the amount of files was huge, I want to read the files with multiprocessing to save some time.

                  我手動將文件分成不同的路徑.單獨使用:

                  I manually divide the files into different path. Using severally:

                  os.chdir("./task_1")
                  files = os.listdir('.')
                  files.sort()
                  for file in files:
                      filename,extname = os.path.splitext(file)
                      if extname == '.csv':
                          f = pd.read_csv(file)
                          df = (f.VALUE.as_matrix()).reshape(75,90)   
                  

                  然后將它們組合起來.

                  如何使用 pool 運行它們來解決我的問題?
                  任何建議將不勝感激!

                  How to run them with pool to achieve my problem?
                  Any advice would be appreciated!

                  推薦答案

                  使用Pool:

                  import os
                  import pandas as pd 
                  from multiprocessing import Pool
                  
                  # wrap your csv importer in a function that can be mapped
                  def read_csv(filename):
                      'converts a filename to a pandas dataframe'
                      return pd.read_csv(filename)
                  
                  
                  def main():
                  
                      # get a list of file names
                      files = os.listdir('.')
                      file_list = [filename for filename in files if filename.split('.')[1]=='csv']
                  
                      # set up your pool
                      with Pool(processes=8) as pool: # or whatever your hardware can support
                  
                          # have your pool map the file names to dataframes
                          df_list = pool.map(read_csv, file_list)
                  
                          # reduce the list of dataframes to a single dataframe
                          combined_df = pd.concat(df_list, ignore_index=True)
                  
                  if __name__ == '__main__':
                      main()
                  

                  這篇關于在 Pandas 中使用多處理讀取 csv 文件的最簡單方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What exactly is Python multiprocessing Module#39;s .join() Method Doing?(Python 多處理模塊的 .join() 方法到底在做什么?)
                  Passing multiple parameters to pool.map() function in Python(在 Python 中將多個參數傳遞給 pool.map() 函數)
                  multiprocessing.pool.MaybeEncodingError: #39;TypeError(quot;cannot serialize #39;_io.BufferedReader#39; objectquot;,)#39;(multiprocessing.pool.MaybeEncodingError: TypeError(cannot serialize _io.BufferedReader object,)) - IT屋-程序員軟件開
                  Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?(Python 多進程池.當其中一個工作進程確定不再需要完成工作時,如何退出腳本?) - IT屋-程序員
                  How do you pass a Queue reference to a function managed by pool.map_async()?(如何將隊列引用傳遞給 pool.map_async() 管理的函數?)
                  yet another confusion with multiprocessing error, #39;module#39; object has no attribute #39;f#39;(與多處理錯誤的另一個混淆,“模塊對象沒有屬性“f)
                  <tfoot id='7JA9g'></tfoot>
                  <legend id='7JA9g'><style id='7JA9g'><dir id='7JA9g'><q id='7JA9g'></q></dir></style></legend>
                  • <small id='7JA9g'></small><noframes id='7JA9g'>

                      <bdo id='7JA9g'></bdo><ul id='7JA9g'></ul>

                          <tbody id='7JA9g'></tbody>

                          <i id='7JA9g'><tr id='7JA9g'><dt id='7JA9g'><q id='7JA9g'><span id='7JA9g'><b id='7JA9g'><form id='7JA9g'><ins id='7JA9g'></ins><ul id='7JA9g'></ul><sub id='7JA9g'></sub></form><legend id='7JA9g'></legend><bdo id='7JA9g'><pre id='7JA9g'><center id='7JA9g'></center></pre></bdo></b><th id='7JA9g'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7JA9g'><tfoot id='7JA9g'></tfoot><dl id='7JA9g'><fieldset id='7JA9g'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 国产资源在线播放 | 性做久久久 | 亚洲影视一区 | 看真人一级毛片 | 九九精品免费视频 | 一级黄色a | 毛片精品 | 欧美日韩成人在线观看 | 一区二区三区四区在线视频 | 亚洲国产欧美日韩在线 | 亚洲欧美日韩国产 | 丰满少妇高潮无套内谢 | 欧美专区第一页 | av大全在线观看 | 一区二区免费视频 | 性做久久久久久久免费看 | 久久99精品久久久久久国产越南 | 欧美日韩亚洲一区 | 国产精品高清在线观看 | 一区二区三区久久久 | 国产欧美日韩在线观看 | 久久精品福利 | 国产亚洲一区二区三区 | 香蕉视频在线免费看 | 91久久综合| 国产精品国产成人国产三级 | 日本一级淫片 | 亚洲精品久 | 国产黄色在线 | 伊人9999 | 亚洲激情欧美激情 | 黄色片一级片 | 国产一区二区视频在线播放 | 国产91精品看黄网站在线观看 | 天天干狠狠操 | 亚洲男人的天堂在线观看 | 免费网站av | 欧美日韩无 | 国产精品aaa| 国产精品成人免费精品自在线观看 | 亚洲二级片 |