Home > database >  (python)Yahoo and pandas-datareader error: RemoteDataError: Unable to read URL
(python)Yahoo and pandas-datareader error: RemoteDataError: Unable to read URL

Time:08-17

I am unable to grab stock data from yahoo finance, even I have done updating pandas and pandas-data reader by commanding pip install --upgrade pandas and pip install --upgrade pandas-datareader on the terminal.

import math
import pandas_datareader as web
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential
from keras.layers import Dense, LSTM
import matplotlib.pyplot as plt

df = web.DataReader('APPL', data_source='yahoo', start='2012-01-01', end='2022-08-17')
df

however I am keep receiving this error message:

RemoteDataError: Unable to read URL: https://finance.yahoo.com/quote/APPL/history?period1=1325390400&period2=1660795199&interval=1d&frequency=1d&filter=history

Can anyone help?

CodePudding user response:

There is no stock called APPL. You probably wanted to write AAPL:

df = web.DataReader('AAPL', data_source='yahoo', start='2012-01-01', end='2022-08-17')

CodePudding user response:

I think your ticker or company id is misspelled.

Could it be 'AAPL'?

  • Related