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

Function read_csv_chunk

tools/io_file.py:218–231  ·  view source on GitHub ↗

读取CSV文件的某一块。 参数: - file_path (str): 文件路径。 - start (int): 起始字节位置。 - end (int): 结束字节位置。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - DataFrame: 该块读取的内容。

(file_path, start, end, encoding='utf-8')

Source from the content-addressed store, hash-verified

216
217
218def read_csv_chunk(file_path, start, end, encoding='utf-8'):
219 """
220 读取CSV文件的某一块。
221
222 参数:
223 - file_path (str): 文件路径。
224 - start (int): 起始字节位置。
225 - end (int): 结束字节位置。
226 - encoding (str): 文件编码格式,默认为 'utf-8'
227
228 返回:
229 - DataFrame: 该块读取的内容。
230 """
231 return pd.read_csv(file_path, skiprows=range(1, start), nrows=end - start, encoding=encoding)
232
233
234def read_json(file_path, encoding='utf-8'):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected