标签:imp 学习 心得 value orm 一个 for csv 均值
# Data Preprocessing Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Importing the dataset
dataest = pd.read_csv(‘Data.csv‘)
X = dataest.iloc[:,:-1].values #自变量 0到-1列为止,所以输出到-2列
y = dataest.iloc[:,3].values # 因变量 此处3代表第四列
# Taking care of missing data
from sklearn.preprocessing import Imputer
imputer = Imputer(missing_values = ‘NAN‘,strategy =‘mean‘,axis = 0)
imputer = imputer.fit(X[:,1:3])
X[:,1:3] = imputer.transform(X[:,1:3])
实现对一个数据中缺失数据的填补,在缺失处放上平均值。
标签:imp 学习 心得 value orm 一个 for csv 均值
原文地址:https://www.cnblogs.com/HDUmusk/p/8954490.html