Skip to content

Instantly share code, notes, and snippets.

@notbanker
notbanker / chained.py
Last active March 10, 2024 17:51
Context manager to temporarily pandas set chained assignment warning to None,'warn' or 'raise, then revert
import pandas as pd
class ChainedAssignent:
""" Context manager to temporarily set pandas chained assignment warning. Usage:
with ChainedAssignment():
blah
with ChainedAssignment('error'):
def running_on_local():
return not running_on_domino()
def running_on_domino():
return ( domino_run_id() is not None )
@notbanker
notbanker / fourth_root_transform.py
Created July 6, 2019 19:34
Turning exponentially distributed data into normally distributed data
import matplotlib.pyplot as plt
import numpy as np
x = np.random.exponential(size=5000)
y = [ pow(x_,0.2654) for x_ in x]
plt.hist(y,bins=51)
plt.show()