简体   繁体   English

AttributeError: 模块 'numpy' 没有属性 'DataReader'

[英]AttributeError: module 'numpy' has no attribute 'DataReader'

Import the libraries导入库

import math
import pandas_datareader as web    
import numpy as web    
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    
plt.style.use('fivethirtyeight')    

Get the stock quote获取股票报价

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

Show the data显示数据

df

AttributeError Traceback (most recent call last) in () ----> 1 df = web.DataReader('AAPL', data_source='yahoo', start='2012-01-01', end='2019-12-17') 2 #Show the data 3 df AttributeError Traceback (最近一次调用最后一次) in () ----> 1 df = web.DataReader('AAPL', data_source='yahoo', start='2012-01-01', end='2019-12- 17') 2 #显示数据 3 df

AttributeError: module 'numpy' has no attribute 'DataReader' AttributeError: 模块 'numpy' 没有属性 'DataReader'

enter image description here在此处输入图片说明

You're overwriting web .你正在覆盖web

Try:尝试:

import pandas_datareader as web    
import numpy as np

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM