Skip to content

Instantly share code, notes, and snippets.

@JoseRFJuniorLLMs
Created January 27, 2018 05:48
Show Gist options
  • Save JoseRFJuniorLLMs/ce46bdef2ac59ea38175916ff636cba2 to your computer and use it in GitHub Desktop.
Save JoseRFJuniorLLMs/ce46bdef2ac59ea38175916ff636cba2 to your computer and use it in GitHub Desktop.
# Data Preprocessing
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 3].values
# 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])
print(X)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment