Kurt Peek
Kurt Peek

Reputation: 57771

Using the Quandl package in Python, get the AttributeError "module 'Quandl' has no attribute get"

On a Windows computer with Anaconda installed, I tried to install the Quandl Python package by typing the following in the command line:

pip install Quandl

I get a confirmation "Successfully installed Quandl-2.8.9". Next, I would like to use Quandl. In a new Python script in Spyder try the following commands:

import Quandl
mydata=Quandl.get("FRED/GDP")

However, this yields the error message

AttributeError: module 'Quandl' has no attribute 'get'

I suspect that Quandl is somehow not installed properly. Is there some aspect of the installation I'm missing?

Upvotes: 0

Views: 2695

Answers (4)

Enayat
Enayat

Reputation: 4052

Renaming the python file name to Quandl.py worked for me.

Upvotes: 0

abm saroar
abm saroar

Reputation: 1

As explained in your code you mentioned:

import Quandl
mydata=Quandl.get("FRED/GDP")

The correct import should be with small letter 'q'

import quandl
mydata=quandl.get("FRED/GDP")

And it worked for me

Upvotes: 0

Edison
Edison

Reputation: 11987

There are a couple of subtle changes and requirements. For example import statements should look like this.

import pandas as pd
import quandl

df = quandl.get('WIKI/GOOGL')

print(df.head())

And your script should be named Quandl.py with a capital Q.

Upvotes: 0

Kurt Peek
Kurt Peek

Reputation: 57771

As pointed out by kindall, I had inadvertently named the script "Quandl.py". I renamed it and the code works as expected.

Upvotes: 3

Related Questions