Skip to content

Instantly share code, notes, and snippets.

View philippschmalen's full-sized avatar
🍏
Charge sustainably

philippschmalen

🍏
Charge sustainably
View GitHub Profile

[Data science project title]

Become less tool-focused and more impact-driven. Summarize a data science project in 10 minutes with the sections below.

🚀Objective

Addresses a specific problem that links to a strategic goal/mission/vision

Examples
@philippschmalen
philippschmalen / logging-compare-dataframes.md
Last active December 29, 2021 10:13
Logging decorator for functions that transform a pandas dataframe. Logs number of rows before and after.

Logging utility that compares pandas dataframes

Standardized logging for data pipelines that transform pandas dataframes.

TL;DR

# logging functions
def logging_transform_df(df_orig: pd.DataFrame, df_edit: pd.DataFrame, step_name: str = 'compare df') -> None:
    "Logging utility to show row difference between two dataframes"

Git config for folders and multiple accounts

You have several github profiles for different uses. For example, one account used privately and another account used professionally. Instead of switching profiles all the time which might be error prone, we can setup different git profiles for each folder.

TL;DR

Go to your user home folder. Open .gitconfig, edit and add includeIf which points to private.gitconfig.

Create private.gitconfig and add your github name and email as below.

"""
This is an example of the app.py file for a dash app deployed on Heroku.
It creates http://esg-trending-test.herokuapp.com/
Follow the steps on https://dash.plotly.com/deployment
to delploy the app with Heroku.
Note:
Put your data into the same folder or subfolder where `app.py` lives.
@philippschmalen
philippschmalen / aws_sagemaker_session_info.py
Last active February 21, 2021 09:02
AWS Sagemaker session info
import boto3
from sagemaker import Session
from sagemaker import get_execution_role
def session_info():
"""Prints and return Sagemaker session info"""
# Session parameters for info
sagemaker_session = Session()
region = boto3.session.Session().region_name
role = get_execution_role()