Skip to content

Instantly share code, notes, and snippets.

@icexelloss
Created October 23, 2018 18:44
Show Gist options
  • Save icexelloss/65388355b4532cbaab16e93aefc0dc08 to your computer and use it in GitHub Desktop.
Save icexelloss/65388355b4532cbaab16e93aefc0dc08 to your computer and use it in GitHub Desktop.
flint_boxcox
import pandas as pd
from scipy import stats
@udf('double')
def boxcox(v):
return pd.Series(stats.boxcox(v)[0])
df = …
# time, v
# 20180101, 1.0
# 20180101, 2.0
# 20180101, 3.0
df = df.addColumnsForCycle({'v_boxcox': boxcox(df['v'])})
# time, v, v_boxcox
# 20180101, 1.0, 0.0
# 20180101, 2.0, 0.852
# 20180101, 3.0, 1.534
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment