Skip to content

Instantly share code, notes, and snippets.

@warrienelly
warrienelly / sampling.py
Last active November 15, 2019 01:30
Sampling with Python
import pandas as pd
import numpy as np
# Read dataset
data = pd.read_csv("data.csv")
## Getting 100 random sample from a dataset
rand_sample = data.sample()
@warrienelly
warrienelly / traintestSplit.py
Last active November 15, 2019 01:40
TrainTest Split
# Train test Split
from sklearn.model_selection import train_test_split
train, test = train_test_split(data, test_size=0.20,random_state=1996)