Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94678 > unrolled thread
| Started by | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| First post | 2015-07-27 16:13 -0700 |
| Last post | 2015-07-27 16:25 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Error: valueError: ordinal must be >= 1 ryguy7272 <ryanshuell@gmail.com> - 2015-07-27 16:13 -0700
Re: Error: valueError: ordinal must be >= 1 Emile van Sebille <emile@fenx.com> - 2015-07-27 16:25 -0700
| From | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| Date | 2015-07-27 16:13 -0700 |
| Subject | Error: valueError: ordinal must be >= 1 |
| Message-ID | <5538a8f6-8c47-4da8-8517-92d860948d93@googlegroups.com> |
Hello experts. I'm working in Python > Anaconda > Spyder.
I'm reading a book called 'Python for Finance' and I'm trying to run this sample code:
import numpy as np
import pandas as pd
import pandas.io.data as web
sp500 = web.DataReader('^GSPC', data_source='yahoo', start='1/1/2000', end='4/14/2014')
sp500.info()
sp500['Close'].plot(grid=True, figsize=(8, 5))
sp500['42d'] = np.round(pd.rolling_mean(sp500['Close'], window=42), 2)
sp500['252d'] = np.round(pd.rolling_mean(sp500['Close'], window=252), 2)
sp500[['Close', '42d', '252d']].tail()
sp500[['Close', '42d', '252d']].plot(grid=True, figsize=(8, 5))
sp500['42-252'] = sp500['42d'] - sp500['252d']
sp500['42-252'].tail()
sp500['42-252'].head()
It seems to work perfectly find when I see the results in the book, but all I'm getting is this . . .
*** ValueError: ordinal must be >= 1
(Pdb)
Does anyone have any idea what I'm doing wrong?
Thanks, all.
[toc] | [next] | [standalone]
| From | Emile van Sebille <emile@fenx.com> |
|---|---|
| Date | 2015-07-27 16:25 -0700 |
| Message-ID | <mailman.1040.1438039545.3674.python-list@python.org> |
| In reply to | #94678 |
On 7/27/2015 4:13 PM, ryguy7272 wrote: <SNIP> > It seems to work perfectly find when I see the results in the book, but all I'm getting is this . . . > *** ValueError: ordinal must be >= 1 > (Pdb) > > Does anyone have any idea what I'm doing wrong? You've been dropped into the python debugger. I'd suspect you've hit a 'import pdb; pdb.set_trace()' or similar line. You can type in 'l' (lower case L) to see the context (you may need to 's' (step) to the appropriate line depending on your version of python.) Alternately, use 'c' to allow the script to continue processing. Otherwise, you'll need to complete debugging the code (as indicated by the break) or comment out/remove the set_trace. Emile
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web