首页 > 解决方案 > 使用 dask.dataframe 读取 csv 的奇怪警告

问题描述

我正在使用 dask 数据框模块来读取 csv。

In [3]: from dask import dataframe as dd                                                                               

In [4]: dd.read_csv("/file.csv", sep=",", dtype=str, encoding="utf-8", error_bad_lines=False, collection=True, blocksize=64e6) 

我以前没有问题,但是今天出现了一个奇怪的警告:

   FutureWarning: The default value of auto_mkdir=True has been deprecated and will be changed to auto_mkdir=False by default in a future release.
      FutureWarning,

直到我意识到它破坏了我的单元测试,这才让我担心,因为当从控制台使用它时,它只是一个简单的警告,但是为我的应用程序设置的测试因此而破坏了。

有谁知道这个警告的原因或如何摆脱它?

标签: pythonwarningspytestdaskfuture-warning

解决方案


文档自动回复:

  • 问题出现在 fsspec==0.6.3 和 dask==2.12.0 中,将来会被删除。
  • 为防止 pytest 由于警告而失败,pytest.ini请在项目中添加或编辑文件并设置
filterwarnings =
    error
    ignore::UserWarning
  • 如果您希望 dask 完全消除警告,请在函数调用中显式设置它storage_options=dict("auto_mkdir"=True)

推荐阅读