Python Learning Experience

Source: Internet
Author: User

# 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 To-1 columns, so output to 2 columns
y = dataest.iloc[:,3].values # variable here 3 for fourth column
# 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])

Achieve the filling of missing data in one data, and put an average value in the missing place.

Python Learning Experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.