Skip to content

Instantly share code, notes, and snippets.

@mrocklin
Last active February 6, 2019 11:43
Show Gist options
  • Select an option

  • Save mrocklin/a6360fc7c91b6ec53101c91dd358e80b to your computer and use it in GitHub Desktop.

Select an option

Save mrocklin/a6360fc7c91b6ec53101c91dd358e80b to your computer and use it in GitHub Desktop.
import os
import random
import feather # pip install feather-format
import pandas as pd
import pandas.util.testing as tm
dates = pd.date_range('2016-01-01', '2016-01-31')
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
symbols = [''.join(random.choice(alphabet)
for i in range(random.randint(2, 4)))
for i in range(10)]
for date in dates:
date = str(date).split()[0]
os.mkdir(date)
for symbol in random.sample(symbols, random.randint(5, 10)):
filename = os.path.join(date, symbol)
df = tm.makeTimeDataFrame(1000).reset_index(drop=True)
feather.write_dataframe(df, filename)
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@changwu-tw

Copy link
Copy Markdown

Hi, I tried from dask import delayed and from dask.imperative import delayed but still got the same error message ImportError: cannot import name delayed. My installed dask version is 0.8.1, and I couldn't find the delayed function. I think the parallel computation is interesting, could you tell me how to fix it? Thanks!

@tnn1t1s

tnn1t1s commented May 4, 2017

Copy link
Copy Markdown

I ran into this same issue when trying Dask for the first time. In my case, the issue was really silly. I had created a file called dask.py, in which I added the line 'from dask import delayed'. A very poor name choice - the collision causes the interpreter to look for delayed in the top level program. ugh. Before I figured this out, I did a search for this error string and found very few results (it got me here) - so I suspect this actually could be your issue. random.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment