美文网首页
pandas分块处理较大csv

pandas分块处理较大csv

作者: Eazow | 来源:发表于2021-11-23 17:52 被阅读0次
    import pandas as pd
    
    def process(input_path, output_path):
        for i, df in enumerate(pd.read_csv(input_path, chunksize=100000)):
            df = _process(df)
            mode = "a" if i != 0 else "w"
            header = True if i == 0 else None
            df.to_csv(output_path, index=None, mode=mode, header=header)
    

    相关文章

      网友评论

          本文标题:pandas分块处理较大csv

          本文链接:https://www.haomeiwen.com/subject/wmnwtrtx.html