我在 Windows 10 上使用 Anaconda;我通过以下方式安装:conda install -c anaconda daskconda install -c conda-forge modinconda update condaconda update anacondaconda update daskconda install -c conda-forge pandas=1.0.5 # this will also download modin 0.7.4-py_0 --> 0.8.0-py_0因此,请考虑以下示例:#!/usr/bin/env python3import ioUSEDASK=Falseif not USEDASK: import pandas as pdelse: from dask.distributed import Client # SO:48067066 client = Client(processes=False) # create scheduler and worker automatically #os.environ["MODIN_ENGINE"] = "dask" # Modin will use Dask import modin.pandas as pdmy_csv_str = """Time[s], Channel 00.000000000000000, -0.7366808056831360.000008000000000, -0.7264851927757260.000016000000000, -0.7213873863220210.000024000000000, -0.7111917734146120.000032000000000, -0.7009961605072020.000040000000000, -0.6908005475997920.000048000000000, -0.6704093217849730.000056000000000, -0.655115902423859"""my_csv_io = io.StringIO()my_csv_io.write(my_csv_str)my_csv_io.seek(0)my_df = pd.read_csv(my_csv_io)my_df.index = pd.to_timedelta(my_df.iloc[:,0], unit='s')print(my_df)当我拥有时USEDASK=False,一切都会按预期进行。当我有 时USEDASK=True,我遇到以下失败:python test\test.pyUserWarning: The Dask Engine for Modin is experimental.UserWarning: Parameters provided defaulting to pandas implementation.To request implementation, send an email to feature_requests@modin.org.Traceback (most recent call last): File "test\test.py", line 30, in <module> my_df.index = pd.to_timedelta(my_df.iloc[:,0], unit='s') File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\tools\timedeltas.py", line 102, in to_timedelta return _convert_listlike(arg, unit=unit, errors=errors)有什么方法可以让这段代码使用 modin+dask 工作吗?
1 回答
慕妹3242003
TA贡献1824条经验 获得超6个赞
这不是一个好的解决方案,但应该使用解决方法:
my_df.index = pd.to_timedelta(my_df.iloc[:,0].values, unit='s')
这对两者都适用USEDASK
是对还是错
添加回答
举报
0/150
提交
取消