Created
December 2, 2018 12:45
-
-
Save Jojozzc/bffa75177985eebe28b2716ea46a4f5c to your computer and use it in GitHub Desktop.
load data from csv file use pandas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
def load_train_data(path='inputFiles/train.csv'): | |
x = [] | |
y = [] | |
data = pd.read_csv(path) | |
data = data.values | |
data_num = len(data) | |
for i in range(0, data_num): | |
line = data[i] | |
label = int(line[len(line) - 1]) | |
row_data = line[1:(len(line) - 1)] | |
x.append(np.array(row_data)) | |
y.append(label) | |
return np.array(x), np.array(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created when joined one data contest