Run Python Script; Nothing Happens

ryguy7272 ryanshuell at gmail.com
Wed Jul 29 15:47:51 CEST 2015


On Wednesday, July 29, 2015 at 9:19:19 AM UTC-4, ryguy7272 wrote:
> I am using Spyder Python 2.7.  I'm running this sample code.
> import numpy as np
> import numpy.random as npr
> import matplotlib.pyplot as plt
> S0 = 100
> r = 0.05
> sigma = 0.25
> T = 30 / 365.
> I = 10000
> ST = S0 * np.exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * npr.standard_normal(I))
> R_gbm = np.sort(ST - S0)
> plt.hist(R_gbm, bins=50)
> plt.xlabel('absolute return')
> plt.ylabel('frequency')
> plt.grid(True)
> 
> I found it in a book, and I'm trying to run various samples of code, in an effort to learn Python.  So, I click the debug button, and this is what I get.
> > c:\users\rshuell001\untitled12.py(1)<module>()
> -> import numpy as np
> (Pdb) 
>  
> It seems like it doesn't really do anything.  So, I click the exit debug button and then click the run button and nothing happens.  I get nothing at all.  In the book, the author got a graph.  I get nothing.  I think, and I could be totally wrong, Python is sending something to a Console, but I can't tell where it goes.  I opened every Console I could find, and I still see nothing happening whatsoever.
> 
> Any idea what's wrong here?

YOU ARE RIGHT!!  THAT WORKED PERFECT!!

I wonder why the author of the book didn't put that in there.

Thanks.


More information about the Python-list mailing list