Skip to content

Instantly share code, notes, and snippets.

@grohith327
Created May 12, 2018 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grohith327/0a1c10ca4d3f33e4b57d1b5e4ca3caad to your computer and use it in GitHub Desktop.
Save grohith327/0a1c10ca4d3f33e4b57d1b5e4ca3caad to your computer and use it in GitHub Desktop.
from sklearn.model_selection import train_test_split
x_train = []
y_train = []
x_test = []
y_test = []
X = []
Y = []
for row in rows:
X.append(int(''.join(row[0].split('/'))))
Y.append(row[3])
x_train, x_test, y_train, y_test = train_test_split(X,Y,train_size=0.9,test_size=0.1) # split training and test data
# Convert lists into numpy arrays
x_train = np.array(x_train)
y_train = np.array(y_train)
x_test = np.array(x_test)
y_test = np.array(y_test)
# reshape the values as we have only one input feature
x_train = x_train.reshape(-1,1)
x_test = x_test.reshape(-1,1)
@bgerber18
Copy link

When I'm running this code I get this error: " X.append(int(''.join(row[0].split('/'))))
ValueError: invalid literal for int() with base 10: '16:00''

@vishnu-k-raveendran
Copy link

the same error is happening here X.append(int(''.join(row[0].split('/'))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment