Previous topic

scikits.timeseries.DateArray.tostring

Next topic

scikits.timeseries.DateArray.asfreq

This Page

scikits.timeseries.DateArray.tolist

DateArray.tolist()

Returns a hierarchical Python list of standard datetime.datetime objects corresponding to the dates of the instance.

If the input is nD, the list will be nested in a such way that np.array(self.tolist()) is also nD and corresponding to the values of the instance.

Examples

>>> d = ts.date_array(start_date=ts.Date('M', '2001-01'), length=5)
>>> d.tolist()
[datetime.datetime(2001, 1, 31, 0, 0),
 datetime.datetime(2001, 2, 28, 0, 0),
 datetime.datetime(2001, 3, 31, 0, 0),
 datetime.datetime(2001, 4, 30, 0, 0),
 datetime.datetime(2001, 5, 31, 0, 0)]
>>> d[:4].reshape(2,2).tolist()
[[datetime.datetime(2001, 1, 31, 0, 0), datetime.datetime(2001, 2, 28, 0, 0)],
 [datetime.datetime(2001, 3, 31, 0, 0), datetime.datetime(2001, 4, 30, 0, 0)]]