Last active
February 6, 2019 11:43
-
-
Save mrocklin/a6360fc7c91b6ec53101c91dd358e80b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
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
Hi, I tried
from dask import delayedandfrom dask.imperative import delayedbut still got the same error messageImportError: 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!