AttributeError: module 'dask.dataframe' has no attribute 'from_dict'

Hello! I’m somewhat new to this, and this is literally my first day using Dask. My searches haven’t found anyone else getting this error, and I’m pretty stumped.

I’ve done

import dask.dataframe as dd

as I saw seems to be the standard.

Then when I try to use dd.from_dict(), I get the Attribute Error in the title. Autocomplete doesn’t happen, shift-tab or question mark on Jupyter both don’t bring anything up. I’d think I made the whole function up if it weren’t for the documentation here.

I’ve also tried dd.DataFrame.from_dict(), but that gives the very similar error:
AttributeError: type object 'DataFrame' has no attribute 'from_dict'

I’ve tried updating my version of Dask, or trying to find if the function is from an outdated version, but I can’t seem to find anything.

Thanks for your time! Can’t wait to see the very obvious thing I’m missing.

Hi @EddisFargo, welcome to Dask Discourse forum!

Well, you should have this method, I just tested myself:

import dask.dataframe as dd
dd.from_dict
<function dask.dataframe.io.io.from_dict(data, npartitions, orient='columns', dtype=None, columns=None, constructor=<class 'pandas.core.frame.DataFrame'>)>

So I guess this is some environment issue. Which Dask version are you using? How did you install it?

Thanks so much for responding! This was my problem!

I used conda install dask on anaconda prompt. When it didn’t work, I tried using conda update dask, which did change some things, but then it still didn’t work. I seem to currently be running dask 2022.7.0, which is unexpected, actually.

I just tried using conda update dask again and strangely, it seems to have downgraded dask to 2022.5.0, so I guess I’m misunderstanding how conda update works. I just tried conda install dask=2023.5.1, which seems to be the current version, and that worked! Now I know not to trust conda update to give me the most recent version, I guess!

Thank you so much for confirming that I wasn’t crazy. Hope you have a great day!

1 Like