Use fix_yahoo_Finance package, here provided pdr_override()
can fix problems that cannot be read
from pandas_datareader import data as pdr
import fix_yahoo_finance as yf
yf.pdr_override() # Used to fix, necessary
# Get data
data = pdr.get_data_yahoo("SPY", start="2017-01-01", end="2017-04-30")
# Print
print(data.head())