[SciPy-user] converting hourly series to annual unneccessaryly masks data
Pierre GM
pgmdevlist at gmail.com
Thu Jan 8 13:03:05 EST 2009
Timmie,
The documentation is still a bit lacking, sorry. Still, in the
docstring of convert, you can see that if you don't precise a func
input parameter, the series is converted to 2D, as stated:
`
If ``func`` is not given, the output series group the points
of the
initial series that share the same new date. For example, if
the
initial series has a daily frequency and is 1D, the output
series is
2D.
`
In your case, each line corresponds to a year, and each column to one
given hour, starting at 01/01-01:00 (or 00:00, I can't remmbr right
now).
Check the shape of your atest variable:
>>> atest.shape
(3, 8784)
Note that 8784 = 366*24: we actually use years of 366 days in that
case, to take leap years into account.
The missing data you observe comes from the facts that:
1. You're not starting at 01/01:00-00, but 8 days later
2. We are using this 366d year: as there are no leap year in your
range of years, the last 24 data of each line will be masked.
3. You don't finish at 12/31-23:00, but (365-8) days earlier.
So all is well and works as expected (developer-wise), no need for a
ticket (good reflex, though).
Now, of course, you need to tell us what you were expecting, and what
kind of average you wanted to calculate.
> test = ts.time_series(np.arange(17520), start_date=ts.now('H'))
> atest = test.convert('A')
>
> In [87]: test
> Out[87]:
> timeseries([ 0 1 2 ..., 17517 17518 17519],
> dates = [08-Jan-2009 18:00 ... 08-Jan-2011 17:00],
> freq = H)
>
>
> In [88]: atest
> Out[88]:
> timeseries(
> [[-- -- -- ..., -- -- --]
> [8574 8575 8576 ..., -- -- --]
> [17334 17335 17336 ..., -- -- --]],
> dates =
> [2009 ... 2011],
> freq = A-DEC)
>
> I entered it at:
> http://scipy.org/scipy/scikits/ticket/84
>
> I'd be glad to receive a comment on waht is happening here.
>
> Thanks in advanve.
> Timmie
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list