python - Pandas with Decimal? -


i'm calculating standard deviations giving floatingpointerrors. wanted try converting data series decimal (using https://docs.python.org/3/library/decimal.html), see if fixes issue.

i can't seem make pandas series of decimal.

how can take normal pd.series of float64 , convert pd.series of decimal, such can do:

series.pct_change().ewm(span=35, min_periods=35).std() 

would work?

def column_round(decimals):      return partial(series.round, decimals=decimals)  df.apply(column_round(2)) 

alternatively lets use np.vectorize can use decimal.quantize function rounding, leave variable decimal instead of np.float64

npquantize = np.vectorize(decimal.decimal.quantize) 

i have been looking , seems solve issue pct_change

ts.diff().div(ts.shift(1)) 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -