Skip to content

Instantly share code, notes, and snippets.

View wkarney's full-sized avatar

Will Karnasiewicz wkarney

View GitHub Profile
@wkarney
wkarney / standardize_column_names.py
Last active February 24, 2020 21:04 — forked from georgerichardson/standardise_column_names.py
[Standardizing Column Names for pandas] Make DataFrame column names lowercase and replace whitespace (and punctuation) with '_' #python #pandas
import re
import string
def standardise_column_names(df, remove_punct=True):
""" Converts all DataFrame column names to lower case replacing
whitespace of any length with a single underscore. Can also strip
all punctuation from column names.
Parameters
----------
@wkarney
wkarney / git-clearHistory
Last active September 16, 2020 18:59 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin https://github.com/<YOUR ACCOUNT>/<YOUR REPO>.git