Skip to content

Instantly share code, notes, and snippets.

View bendangnuksung's full-sized avatar
👷‍♂️
At work

Bendang bendangnuksung

👷‍♂️
At work
View GitHub Profile
@bendangnuksung
bendangnuksung / split_shuffle.py
Created September 21, 2017 08:54
Function to Split (Train and Test) and Shuffle a CSV file
import random
#eg: shuffle_split(80, "xyz.csv") 80= 80% train, 20% Test. xyz.csv= source_file
def shuffle_split(train_size, filename):
data=open(filename, "r")
train1=open("train.csv", "w")
test1= open("test.csv", "w")
read_data= data.readlines()