Skip to content

Instantly share code, notes, and snippets.

@f4ww4z
Created June 22, 2019 10:16
Show Gist options
  • Save f4ww4z/422b6511443e95fe8d3dadcbcfac15b2 to your computer and use it in GitHub Desktop.
Save f4ww4z/422b6511443e95fe8d3dadcbcfac15b2 to your computer and use it in GitHub Desktop.
A template to process data for machine learning models
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
# Importing the dataset
data = pd.read_csv('Data.csv')
# Separate independent and dependent variables
X = data.iloc[:, :-1].values
y = data.iloc[:, 3].values
# Splitting dataset into training set and test set
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=0)
"""# Feature scaling
sc_X = StandardScaler()
X_train = sc_X.fit_transform(X_train)
X_test = sc_X.transform(X_test)"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment