'DataFrame' 对象没有属性 'as_matrix [英] 'DataFrame' object has no attribute 'as_matrix
本文介绍了'DataFrame' 对象没有属性 'as_matrix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import pandas as pd
from sklearn.model_selection import train_test_split
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import ensemble
from sklearn.metrics import mean_absolute_error
from joblib import *
df = pd.read_csv('~/Downloads/Melbourne_housing_FULL.csv')
df.head(n=5)
del df['Address']
del df['Method']
del df['SellerG']
del df['Date']
del df['Postcode']
del df['Lattitude']
del df['Longtitude']
del df['Regionname']
del df['Propertycount']
df.dropna(axis=0, how='any', thresh=None, subset=None, inplace=True)
features_df = pd.get_dummies(df, columns=['Suburb', 'CouncilArea', 'Type'])
X = features_df.as_matrix()
y = df['Price'].as_matrix()
任何人都可以帮助我我在输入 X = features_df.as_matrix() 后立即遇到错误y = df['Price'].as_matrix() 并且我正在通过 Oliver 的一本名为 Machine Learning with python 的书学习机器学习......非常感谢任何帮助,谢谢
Can anyone please help me I am facing a error as soon as I put X = features_df.as_matrix() y = df['Price'].as_matrix() and I am learning Machine Learning with a book called Machine Learning with python by oliver... Any Help is highly appreciated Thankyou
推荐答案
df.as_matrix() 在 0.23.0 版本后被降价使用 df.values(),
df.as_matrix() was depriciated after the version 0.23.0 use df.values(),
遵循这个 了解更多.
这篇关于'DataFrame' 对象没有属性 'as_matrix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文