cumprod() seems to give me a bunch of partially blank values

Viewed 29

I'm a bit new to Python still

Here's my code:

np.random.seed(102)
mu = 0.001
sigma= 0.01
p0= 369
returns = np.random.normal(mu, sigma, size=252 )
cum_g = 1+returns.cumprod()
print ( returns[0:10] )
print( cum_g[0:10] )

cum_g[-1]

For some reason, if I run:

returns

I'll get a proper array that looks like:

Proper array results

But for some reason, running this:

cum_g = 1+returns.cumprod()

Results in an array of 1. and blank values

Blank values

It looks as if function tried rounding to the nearest whole number after a certain point, I'm not sure if this is actually the result or if I've made some mistake

0 Answers
Related