#Code Snippet Corner

Code Snippet Corner

Your weekly dose of Python tidbits and Jupyter notebooks to get you feeling saucy.

Using Pandas and SQLAlchemy to Simplify Databases
Post 1

Using Pandas and SQLAlchemy to Simplify Databases

Use SQLAlchemy with PyMySQL to make database connections easy.
Getting Conda Envs (And Environment Variables!) To Play Nicely With Cron
Post 2

Getting Conda Envs (And Environment Variables!) To Play Nicely With Cron

Set up CRON jobs to interact with Conda environments.
A Dirty Way of Cleaning Data (ft. Pandas & SQL)
Post 3

A Dirty Way of Cleaning Data (ft. Pandas & SQL)

Cleaning data in Pandas the dirty way.
Trash Pandas: Messy, Convenient DB Operations via Pandas
Post 4

Trash Pandas: Messy, Convenient DB Operations via Pandas

(And a way to clean it up with SQLAlchemy).
All That Is Solid Melts Into Graphs
Post 5

All That Is Solid Melts Into Graphs

Reshaping Pandas dataframes with a real-life example, and graphing it with Altair.
Importing Excel Datetimes Into Pandas, Part I
Post 6

Importing Excel Datetimes Into Pandas, Part I

Pandas & Excel, Part 1.
Importing Excel Datetimes Into Pandas, Part II
Post 7

Importing Excel Datetimes Into Pandas, Part II

Import dates & times from Excel .xlsx files into Pandas!
Tuning Machine Learning Hyperparameters with Binary Search
Post 8

Tuning Machine Learning Hyperparameters with Binary Search

Tune the n_estimators parameter in for a Random Forests classifier in scikit-learn in Python.
Tuning Random  Forests Hyperparameters with Binary Search Part II: max_depth
Post 9

Tuning Random Forests Hyperparameters with Binary Search Part II: max_depth

Tune the max_depth parameter in for a Random Forests classifier in scikit-learn in Python
Tuning Random Forests Hyperparameters with Binary Search Part III: min_samples_leaf
Post 10

Tuning Random Forests Hyperparameters with Binary Search Part III: min_samples_leaf

Tune the min_samples_leaf parameter in for a Random Forests classifier in scikit-learn in Python .
Using Random Forests for Feature Selection with Categorical Features
Post 11

Using Random Forests for Feature Selection with Categorical Features

Python helper functions for adding feature importance, and displaying them as a single variable.
Downcast Numerical Data Types with Pandas
Post 12

Downcast Numerical Data Types with Pandas

Using an Example Where We Downcast Numerical Columns.
Removing Duplicate Columns in Pandas
Post 13

Removing Duplicate Columns in Pandas

Dealing with duplicate column names in your Pandas DataFrame.
Recasting Low-Cardinality Columns as Categoricals
Post 14

Recasting Low-Cardinality Columns as Categoricals

Downcast strings in Pandas to their proper data-types using HDF5.