Where is the mistake?

Tried this fir fetching data from QUANDL 

Import the quandl

import quandl

To get your API key, sign up for a free Quandl account.

Then, you can find your API key on Quandl account settings page.

QUANDL_API_KEY = 'ksuxNtz_RWZKWbT85iec'

This is to prompt you to change the Quandl Key

if QUANDL_API_KEY == 'ksuxNtz_RWZKWbT85iec':

 raise Exception("Please provide a valid Quandl API key!")

Set the start and end date

start_date = '1990-01-01'

end_date = '2018-03-01'

Set the ticker name

ticker = 'AMZN'

Feth the data

data = quandl.get('WIKI/'+ticker, start_date=start_date,

 end_date=end_date, api_key=QUANDL_API_KEY)

Print the first 5 rows of the dataframe

data.head()



getting output as

    

 runfile('C:/Users/Priyanka/.spyder-py3/temp.py', wdir='C:/Users/Priyanka/.spyder-py3')

Traceback (most recent call last):



  File "C:\Users\Priyanka.spyder-py3\temp.py", line 8, in <module>

    raise Exception("Please provide a valid Quandl API key!")                                                            



Exception: Please provide a valid Quandl API key!

Hi Swastik,



Please use the following code:


Import the quandl

import quandl

To get your API key, sign up for a free Quandl account.

Then, you can find your API key on Quandl account settings page.


QUANDL_API_KEY = 'ksuxNtz_RWZKWbT85iec'

# Set the start and end date
start_date = '1990-01-01'
end_date = '2018-03-01'

# Set the ticker name
ticker = 'AMZN'

# Fetch the data
data = quandl.get('WIKI/'+ticker, start_date=start_date,end_date=end_date, api_key=QUANDL_API_KEY)

# Print the first 5 rows of the dataframe
data.head()

Kindly let me know in case there is still any issue.

The mistake is in the following command:



if QUANDL_API_KEY == 'ksuxNtz_RWZKWbT85iec': raise Exception("Please provide a valid Quandl API key!")



Above command is stopping the code from giving you data that you need because the above command is to give the output as "Please provide a valid Quandl API key!"