A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
# You might need to install extension first: | |
# !pip install git+https://github.com/sursingh/dotmagic.git | |
# Load the magic | |
%load_ext dotmagic | |
style='filled' | |
color='lightblue' | |
%%dot -p |
import os | |
import pwd | |
import psutil | |
import re | |
import string | |
import requests | |
import socket | |
import argparse | |
import tabulate | |
import pandas as pd |
git branch -m new_branch # Rename currently checked out branch locally | |
git branch -m old_branch new_branch # Rename old_branch to new_branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
# Pandas wide display | |
pd.set_option('display.max_columns', None) | |
pd.set_option('display.expand_frame_repr', False) | |
pd.set_option('max_colwidth', -1) |
#!/usr/bin/env python | |
import sys | |
from isort.hooks import git_hook | |
sys.exit(git_hook(strict=True, modify=True)) |
import logger | |
import os | |
import time | |
LOG_NAME = 'app_name' | |
LOG_DIR = '../log' | |
log_fmt = '%(levelname).1s %(message)s' | |
logging.basicConfig(level=logging.DEBUG, format=log_fmt) | |
logger = logging.getLogger(__name__) |
# Text color variables | |
# Sample usage: $bldblu Respository $txtrst is $bldred not clean $txtrst" | |
txtund=$(tput sgr 0 1) # Underline | |
txtbld=$(tput bold) # Bold | |
bldred=${txtbld}$(tput setaf 1) # red | |
bldblu=${txtbld}$(tput setaf 4) # blue | |
bldwht=${txtbld}$(tput setaf 7) # white | |
# Reset | |
txtrst=$(tput sgr0) |