2

I am learning pandas in Python.Below is my code in Terimal:

import pandas as pd
dates = pd.date_range('20130101', periods=6)

Then I get this message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'date_range'

How to solve this problem?

4
  • What does print(pd.__file__) show? Maybe you're shadowing the pandas module with one of your own. Commented Jan 30, 2015 at 2:03
  • @DSM It shows "/usr/lib/pymodules/python2.7/pandas/__init__.pyc " Commented Jan 30, 2015 at 2:10
  • What about print(pd.version.version)? Commented Jan 30, 2015 at 2:11
  • @DSM It shows "0.7.0" Commented Jan 30, 2015 at 2:13

1 Answer 1

2

You can't find date_range because you're using pandas version 0.7.0, which is very old (~9 Feb 2012) in pandas time-- the current stable version (29 Jan 2015) is 0.15.2.

You're going to want to upgrade, not only because of bug fixes and new features, but because many of the examples you're going to find on the web won't work for you otherwise.

Sign up to request clarification or add additional context in comments.

2 Comments

You know, the pandas docs aren't very helpful, no "Introduced in 0.x" anywhere.
@epx, so did you succeed? What was the command you use to perform the upgrade?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.