I am using anaconda with python 3. In spyder I run following code
import pandas as pd
import quandl
import math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.leanear_model import LearnRegression
df = quandl.get('WIKI/GOOGL')
df = df[['Adj. Open','Adj. High','Adj. Low','Adj. Close','Adj. Volume',]]
df['HL_PCT'] = (df['Adj. High'] - df['Adj. Close']) / df['Adj. Close']*100.0
df['PCT_change'] = (df['Adj. Close'] - df['Adj. Open']) / df['Adj. Open']*100.0
df = df[['Adj. Close','HL_PCT','PCT_change','Adj. Volume']]
forecast_col='Adj. Close'
df.fillna(-99999, inplace=True)
forecast_out=int(math.ceil(0.01*len(df)))
df['label'] = df[forecast_col].shift(-forecast_out)
df.dropna(inplace=True)
X = np.array(df.drop(['label'],1))
y=np.array(df['label'])
X = preprocessing.scale(X)
X=X[:-forecast_out+1]
df.drona(inplace=True)
y = np.array(df['label'])
print(len(X),len(y))
but it shows following error
runfile('C:/Users/jayram/.spyder-py3/temp.py', wdir='C:/Users/jayram/.spyder-py3')
C:\Users\jayram\Anaconda3\lib\site-packages\sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
File "<ipython-input-1-f93a3ccc2710>", line 1, in <module>
runfile('C:/Users/jayram/.spyder-py3/temp.py', wdir='C:/Users/jayram/.spyder-py3')
File "C:\Users\jayram\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\jayram\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/jayram/.spyder-py3/temp.py", line 6, in <module>
from sklearn.leanear_model import LearnRegression
ModuleNotFoundError: No module named 'sklearn.leanear_model'
anaconda has all packages install? then why above error shows? or we have to install packages after installing anaconda?
It's linear_model, not leanear.
http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
Also, it seems your code does not use classes from that module at all, so you can simply remove that line