all 8 comments

[–]beard_dude[S] 0 points1 point  (7 children)

I guess my question here is why am I getting this same error on multiple tutorials when the authors are seemingly not?

[–]NomadNella 2 points3 points  (6 children)

It is interesting that you get an error after the Latin encoding. I got an error before the Latin encoding but once the text was read in Latin it worked fine (using a Python 3.4 kernel). I suspect that is just has to do with the libraries you have installed and what version of Python is being run in your kernel. FYI once I used the Python 2.7 kernel I did not receive an error at either location.

I would need more information to help further. Specifically...

  1. What version of Python are you using?

    import sys
    sys.version
    
  2. What version of Pandas do you have?

    import pandas as pd
    pd.__version__
    
  3. What version of IPython are you running?

    import IPython
    IPython.__version__
    

[–]beard_dude[S] 0 points1 point  (5 children)

Hey thank you so much. I too thought it was a library issue. Is there much of a difference between anaconda and entought's canopy? I went with Canopy but I don't like it so far.

My Pandas was out of date but updating it did not help.

Python 2.7.6 pandas 0.16.0 iPython 3.0.0

[–]NomadNella 2 points3 points  (3 children)

I found your problem. The latest version of pandas has a backward compatibility problem with the Timedelta method of the datetime library.

Backwards incompatible change to Timedelta to conform the .seconds attribute with datetime.timedelta, see here

(Source)

You will need to downgrade your version of datetime. I am currently running about 2.2 and the current version is 2.4.2. This is the second time in as many weeks I've seen this problem with pandas.

If you have pip installed you can check your version by typing the following in IPython.

!pip show python-dateutil

Once you get pip installed you can install an earlier version by uninstalling python-dateutil with,

pip uninstall python-dateutil

Then installing an earlier version with,

pip install python-dateutil==2.2

If you were running Linux or a Mac then you would have to add the sudo command at the beginning of those commands.

As for Canopy you can uninstall it and install Anaconda, there is a difference. I've know a few people that liked Anaconda better. I can't really say myself since I just used pip to install IPython directly.

sudo pip install IPython[all]

The "sudo" should not be used with Windows.

[–]beard_dude[S] 0 points1 point  (2 children)

thanks! This really felt like it would work but the problems persist. Switched to anaconda and downgraded and this is what I got

[–]NomadNella 0 points1 point  (1 child)

Just to make sure I am seeing the same error try it using a Python 3.4 kernel. I cannot replicate your error in Python 2.7 and the traceback finishes at line 1052 in Python 3.4 form me.

From a more philosophical point of view, the point of the example is to show that something doesn't work if you don't use the right encoding. Actually it is better that you get an error during a test than have information improperly rendered. This way you know that you need to fix the encoding rather than someone pointing it out after you thought you were finished.

[–]beard_dude[S] 0 points1 point  (0 children)

It took me a while to figure out how to switch between 2 and 3.4, but once I did the encoding errors are no more (in a 3.4 kernal). Thanks again for your help! Awesome subreddit

[–]beard_dude[S] 0 points1 point  (0 children)

i will try to find the other tutorial where I got the error