Python Argparse Cookbook

I use Python as my go-to tool for command-line scripts, these often requiring parsing command-line arguments. Since I use various programming languages I don’t remember anything, so I create reference docs for myself and hopefully others. So similar to my Python String Format Cookbook, that is examples for string and number formatting, I wrote this […]

Python Data Science

My notes, resources and examples using Python, NumPy, SciPy and Matplotlib as alternatives to R and Matlab for data science and analysis. Load Data from Text File An example loading comma delimited data using Numpy: Plotting and Graphing Log Scale Labels for Titles and Axes Saving a Graph The following will create a png image […]

Python Date Formatting

A set of examples working with Python date and time functions, including formatting dates, date calculations, and other common date tasks. See my string format examples for working with python strings. First off, all examples use the following import, any additional imports needed will be shown with the example. Creating Date Objects Typically the first […]

Python String Format Cookbook

Python v2.7 introduced a new string fomatting method, that is now the default in Python3. I started this string formatting cookbook as a quick reference to help me format numbers and strings. Thanks to other contributors I’ve expanded the examples over time. Python 3.6 introduced, formatted string literals, often referred to as f-strings as another […]

Use Python + Selenium to Automate Web Timing

I’ve been hearing a lot recently about the Navigation Timing spec, which sets a multitude of timing events as javascript properties. There are numerous events in the flow, from the very first navigation event, which could be when the user clicks a search result in Google, to DNS timing to Dom parsing etc. See the […]