小编pab*_*agn的帖子

Polars for Python:读取数据帧时如何消除“确保传递文件路径而不是 python 文件对象”警告?

该声明

  • Polars.read_csv()我正在通过 Python 文件处理程序使用方法读取数据集:
 with gzip.open(os.path.join(getParameters()['rdir'], dataset)) as compressed_file:
    df = pl.read_csv(compressed_file, sep = '\t', ignore_errors=True)
Run Code Online (Sandbox Code Playgroud)
  • 不断弹出性能警告:
Polars found a filename. Ensure you pass a path to the file instead of a python file object when possible for best performance.
Run Code Online (Sandbox Code Playgroud)

可能的解决方案

  • 我已经尝试过 Python 警告抑制,但似乎 Polars 实际上只是打印出此语句,而没有任何关联的默认警告。
  • 另一种可能性是使用非处理程序方法进行读取?

任何关于如何摆脱这个恼人的消息的想法将受到高度赞赏。

python dataframe python-polars

6
推荐指数
1
解决办法
778
查看次数

标签 统计

dataframe ×1

python ×1

python-polars ×1