小编Jam*_*non的帖子

机器学习 - 与sklearn

我正在写一个基本的股票预测代码,但是我不断收到以下错误.

AttributeError:'function'对象没有属性'train_test_split'

除了这一切之外,我的代码似乎都是正确的,并且在编码过程中一直运行测试.所以我很确定没有其他问题导致这个问题比python的库问题.有没有人知道这个问题的解决方法,以便项目可以继续?如果这是任何帮助,这是我的代码.

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

#Getting the data
df = quandl.get("WIKI/GOOGL")

#Selecting the data we want from the database
df = df[['Adj. Open','Adj. High','Adj. Low','Adj. Close','Adj. Volume']]

#Calculating percentage changes
df['HL_PCT'] = (df['Adj. High'] - df['Adj. Close']) / df['Adj. Close'] * 100
df['PCT_change'] = (df['Adj. Close'] - df['Adj. Open']) / df['Adj. Open'] * 100

#Refining the data even …
Run Code Online (Sandbox Code Playgroud)

python dataframe python-3.x scikit-learn

1
推荐指数
1
解决办法
139
查看次数

标签 统计

dataframe ×1

python ×1

python-3.x ×1

scikit-learn ×1