MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / write_csv_chunk

Function write_csv_chunk

tools/io_file.py:532–542  ·  view source on GitHub ↗

写入CSV文件的某一块。 参数: - file_path (str): 文件路径。 - chunk (DataFrame): 要写入的CSV数据块。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - encoding (str): 写入文件的编码格式,默认为 'utf-8'。

(file_path, chunk, mode, encoding='utf-8')

Source from the content-addressed store, hash-verified

530
531
532def write_csv_chunk(file_path, chunk, mode, encoding='utf-8'):
533 """
534 写入CSV文件的某一块。
535
536 参数:
537 - file_path (str): 文件路径。
538 - chunk (DataFrame): 要写入的CSV数据块。
539 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
540 - encoding (str): 写入文件的编码格式,默认为 'utf-8'
541 """
542 chunk.to_csv(file_path, mode=mode, encoding=encoding, index=False, header=(mode == 'w'))
543
544
545def write_json(file_path, data, mode, encoding='utf-8'):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected