lines2skip = np.random.choice(np.arange(1, nlinesfile + 1), nlinesfile -
    nlinesrandomsample, replace=False)
df = pd.read_csv(filename, skiprows=lines2skip)
Read a small random sample from a big CSV file into a Python data frame