Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Noob needing some help
#1
I am a new python user and I don't understand this error message. The code I have is:

import pandas as pd
import quandl, math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression

df = quandl.get("WIKI/GOOGL", authtoken="X5A1-ewy2UCfkFVfGKuW")
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.dropna(inplace=True)
y= np.array(df["label"])

print(len(x),len(y))
And the error I am getting is:

Error:
line 41 "This module will be removed in 0.20.", DeprecationWarning) 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.
Reply
#2
Whatever line it's referencing is using an old interface which won't exist in future versions of whatever library you're using on that line. It might work fine now, though.
Reply
#3
post your actual code. your error cite line 41 and you have just 31 lines in the code.
in general this is not error, but depreciation warning - some module (sklearn.preprocessing?) you use is depreciated and will be replaced by model_selection in next version. you will need to update your code if you want to move to next sklearn version.

EDIT: from the docs (ver. 18.0)
Quote:The model_selection module

The new module sklearn.model_selection, which groups together the functionalities of formerly sklearn.cross_validation, sklearn.grid_search and sklearn.learning_curve, introduces new possibilities such as nested cross-validation and better manipulation of parameter searches with Pandas.

so, from what you import it is sklearn.cross_validation that has been depreciated.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020