Skip to content

Instantly share code, notes, and snippets.

View svercillo's full-sized avatar
🎯
Focusing

Stefan Vercillo svercillo

🎯
Focusing
  • Waterloo
View GitHub Profile
@kelvintaywl
kelvintaywl / split.py
Last active October 8, 2024 08:21
Python Script to split CSV files into smaller files based on number of lines
import csv
import sys
import os
# example usage: python split.py example.csv 200
# above command would split the `example.csv` into smaller CSV files of 200 rows each (with header included)
# if example.csv has 401 rows for instance, this creates 3 files in same directory:
# - `example_1.csv` (row 1 - 200)
# - `example_2.csv` (row 201 - 400)
# - `example_3.csv` (row 401)