不可哈希类型:将 modin 与 pandas 一起使用时的系列?

我在 Windows 10 上使用 Anaconda;我通过以下方式安装:


conda install -c anaconda dask

conda install -c conda-forge modin

conda update conda

conda update anaconda

conda update dask

conda 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 python3


import io


USEDASK=False


if not USEDASK:

  import pandas as pd

else:

  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 pd


my_csv_str = """Time[s], Channel 0

0.000000000000000, -0.736680805683136

0.000008000000000, -0.726485192775726

0.000016000000000, -0.721387386322021

0.000024000000000, -0.711191773414612

0.000032000000000, -0.700996160507202

0.000040000000000, -0.690800547599792

0.000048000000000, -0.670409321784973

0.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.py

UserWarning: 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 工作吗?


白板的微信
浏览 84回答 1
1回答

慕妹3242003

这不是一个好的解决方案,但应该使用解决方法:my_df.index&nbsp;=&nbsp;pd.to_timedelta(my_df.iloc[:,0].values,&nbsp;unit='s')这对两者都适用USEDASK是对还是错
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python