Useful scripts, untangled.
Practical Python, VBA and R for data, analytics and automation. Every script starts with a real problem, then gets annotated block by block, simplified, and extended with variations you can drop in.
How each script is written up
- ProblemWhat you're trying to do, in plain words.
- ScriptComplete, tested, copy or download.
- How it worksEach block explained.
- VariationsTweaks and add-ons for your case.
Latest scripts
-
Clean a messy CSV export with pandas
One command that fixes headers, trims whitespace, removes blank and duplicate rows, and converts text to real numbers and dates.
-
Merge every Excel file in a folder into one sheet (VBA)
A single macro that stacks the first sheet of each workbook in a folder into one master sheet, tagging every row with its source file.
-
Log serial port data to CSV with Python
Read lines from an Arduino, sensor or lab instrument over a serial port and save each one with a timestamp, ready for Excel or pandas.