zipline icon indicating copy to clipboard operation
zipline copied to clipboard

Ingest error: TypeError: data type "datetime" not understood

Open ghost opened this issue 8 years ago • 8 comments

Dear Zipline Maintainers,

Before I tell you about my issue, let me describe my environment:

Environment

  • Operating System: (Windows Version or $ uname --all)

Linux raffaele-GL753VD 4.14.13-041413-generic #201801101001 SMP Wed Jan 10 10:02:53 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

  • Python Version: $ python --version Python 3.6.3 :: Anaconda, Inc.
  • Python Bitness: $ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'

64

  • How did you install Zipline: (pip, conda, or other (please explain))

pip

  • Python packages: $ pip freeze or $ conda list

alembic==0.9.7 bcolz==0.12.1 Bottleneck==1.2.1 certifi==2017.11.5 chardet==3.0.4 click==6.7 contextlib2==0.5.5 cyordereddict==1.0.0 Cython==0.27.3 DateTime==4.2 decorator==4.2.1 empyrical==0.3.3 idna==2.6 intervaltree==2.1.0 Logbook==1.1.0 lru-dict==1.1.6 Mako==1.0.7 MarkupSafe==1.0 multipledispatch==0.4.9 networkx==2.0 numexpr==2.6.4 numpy==1.14.0 pandas==0.18.1 pandas-datareader==0.5.0 patsy==0.5.0 python-dateutil==2.6.1 python-editor==1.0.3 pytz==2017.3 requests==2.18.4 requests-file==1.4.3 requests-ftp==0.3.1 scipy==1.0.0 six==1.11.0 sortedcontainers==1.5.9 SQLAlchemy==1.2.1 statsmodels==0.8.0 tables==3.4.2 toolz==0.9.0 urllib3==1.22 zipline==1.1.1 zope.interface==4.4.3

Now that you know a little about me, let me tell you about the issue I am having:

Description of Issue

When I run QUANDL_API_KEY=<KEY> zipline ingest -b quandl I get an error message: TypeError: data type "datetime" not understood

  • What did you expect to happen? To download the data without error messages

  • What happened instead? The error message is shown

Here is how you can reproduce this issue on your machine:

Reproduction Steps

  1. virtual env zipline
  2. cd zipline
  3. source ./bin/activate
  4. pip install zipline
  5. QUANDL_API_KEY=<KEY> zipline ingest -b quandl

What steps have you taken to resolve this already?

Looked into the web and it's related to an outdated version of pandas. But the outdated version is forced by the dependency of zipline

Anything else?

Here is the full log:

Downloading WIKI metadata: Traceback (most recent call last): File "/media/raffaele/DATA/data/progetti_miei/zipline/bin/zipline", line 11, in sys.exit(main()) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/click/core.py", line 722, in call return self.main(*args, **kwargs) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/zipline/main.py", line 312, in ingest show_progress, File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/zipline/data/bundles/core.py", line 451, in ingest pth.data_path([name, timestr], environ=environ), File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/zipline/data/bundles/quandl.py", line 295, in quandl_bundle show_progress=show_progress, File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/zipline/data/bundles/quandl.py", line 129, in fetch_symbol_metadata_frame data['auto_close_date'] = data['end_date'] + pd.Timedelta(days=1) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/pandas/core/ops.py", line 609, in wrapper na_op) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/pandas/core/ops.py", line 569, in maybe_convert_for_time_op return cls(left, right, name, na_op) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/pandas/core/ops.py", line 282, in init lvalues = self._convert_to_array(left, name=name) File "/media/raffaele/DATA/data/progetti_miei/zipline/lib/python3.6/site-packages/pandas/core/ops.py", line 398, in _convert_to_array if (inferred_type in ('datetime64', 'datetime', 'date', 'time') or TypeError: data type "datetime" not understood

Sincerely, $ whoami Raffaele

ghost avatar Jan 18 '18 11:01 ghost

I am also having the same issue

techsethi avatar Jan 22 '18 08:01 techsethi

exactly the same issue, any help?

code2free2 avatar Jan 25 '18 06:01 code2free2

Hi there. The latest README also reflects the latest zipline. The Quandl bundle is fixed on the zipline master branch and it looks like you have zipline 1.1.1 installed. If you install the latest zipline from GitHub then you shouldn't see this error.

In the next release (which would presumably be 1.1.2) you can just install zipline as you normally would.

freddiev4 avatar Jan 25 '18 18:01 freddiev4

If you install the latest zipline from GitHub then you shouldn't see this error.

How do I install from Github ? Thanks in advance.

On Thu, Jan 25, 2018 at 11:41 PM, Freddie Vargus [email protected] wrote:

Hi there. The latest README also reflects the latest zipline. The Quandl bundle is fixed on the zipline master branch and it looks like you have zipline 1.1.1 installed. If you install the latest zipline from GitHub then you shouldn't see this error.

In the next release (which would presumably be 1.1.2) you can just install zipline as you normally would.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/quantopian/zipline/issues/2082#issuecomment-360551438, or mute the thread https://github.com/notifications/unsubscribe-auth/AAh0wOICMFyvfiOzFsef_Ks5WQPLDyFpks5tOMPIgaJpZM4RixRE .

-- Pradeep Sethi

techsethi avatar Feb 01 '18 03:02 techsethi

@techsethi you can install from GitHub with:

git clone [email protected]:quantopian/zipline.git
pip install zipline/

freddiev4 avatar Feb 01 '18 03:02 freddiev4

Hi, I'm runnig

git clone [email protected]:quantopian/zipline.git

and I get

[email protected]: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

thanks

EMTRANSLATEUR355 avatar Feb 25 '18 18:02 EMTRANSLATEUR355

@EMTRANSLATEUR355 can you try cloning with https?

git clone https://github.com/quantopian/zipline.git

freddiev4 avatar Feb 25 '18 21:02 freddiev4

Closing this should be fixed in the latest release of zipline. You can see the release notes here Feel free to update to 1.2.0 with either:

pip install -U zipline

or

conda update zipline -c quantopian

Zipline is packaged for Py27 and Py35. If there are any problems, please open a new issue 🙂

freddiev4 avatar Apr 05 '18 14:04 freddiev4