n = 1000000
s = 10000
filename = 'data.txt'
skip = sorted(random.sample(range(n), n - s))
df = pandas.read_csv(filename, skiprows=skip)
Read a small random sample from a big CSV file into a Python data frame