@@ -249,30 +249,30 @@ class DatetimeAccessor(Properties):
249
249
>>> ts
250
250
<xarray.DataArray (time: 10)>
251
251
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000',
252
- '2000-01-03T00:00:00.000000000', '2000-01-04T00:00:00.000000000',
253
- '2000-01-05T00:00:00.000000000', '2000-01-06T00:00:00.000000000',
254
- '2000-01-07T00:00:00.000000000', '2000-01-08T00:00:00.000000000',
255
- '2000-01-09T00:00:00.000000000', '2000-01-10T00:00:00.000000000'],
256
- dtype='datetime64[ns]')
252
+ '2000-01-03T00:00:00.000000000', '2000-01-04T00:00:00.000000000',
253
+ '2000-01-05T00:00:00.000000000', '2000-01-06T00:00:00.000000000',
254
+ '2000-01-07T00:00:00.000000000', '2000-01-08T00:00:00.000000000',
255
+ '2000-01-09T00:00:00.000000000', '2000-01-10T00:00:00.000000000'],
256
+ dtype='datetime64[ns]')
257
257
Coordinates:
258
- * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-10
259
- >>> ts.dt
260
- <xarray.core.accessor_dt.DatetimeAccessor object at 0x118b54d68 >
258
+ * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-10
259
+ >>> ts.dt # doctest: +ELLIPSIS
260
+ <xarray.core.accessor_dt.DatetimeAccessor object at 0x... >
261
261
>>> ts.dt.dayofyear
262
262
<xarray.DataArray 'dayofyear' (time: 10)>
263
263
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
264
264
Coordinates:
265
- * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-10
265
+ * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-10
266
266
>>> ts.dt.quarter
267
267
<xarray.DataArray 'quarter' (time: 10)>
268
268
array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
269
269
Coordinates:
270
- * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-10
270
+ * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-10
271
271
272
272
"""
273
273
274
274
def strftime (self , date_format ):
275
- '''
275
+ """
276
276
Return an array of formatted strings specified by date_format, which
277
277
supports the same string format as the python standard library. Details
278
278
of the string format can be found in `python string format doc
@@ -290,13 +290,12 @@ def strftime(self, date_format):
290
290
291
291
Examples
292
292
--------
293
+ >>> import datetime
293
294
>>> rng = xr.Dataset({"time": datetime.datetime(2000, 1, 1)})
294
295
>>> rng["time"].dt.strftime("%B %d, %Y, %r")
295
296
<xarray.DataArray 'strftime' ()>
296
297
array('January 01, 2000, 12:00:00 AM', dtype=object)
297
298
"""
298
-
299
- '''
300
299
obj_type = type (self ._obj )
301
300
302
301
result = _strftime (self ._obj .data , date_format )
@@ -398,32 +397,32 @@ class TimedeltaAccessor(Properties):
398
397
>>> ts
399
398
<xarray.DataArray (time: 20)>
400
399
array([ 86400000000000, 108000000000000, 129600000000000, 151200000000000,
401
- 172800000000000, 194400000000000, 216000000000000, 237600000000000,
402
- 259200000000000, 280800000000000, 302400000000000, 324000000000000,
403
- 345600000000000, 367200000000000, 388800000000000, 410400000000000,
404
- 432000000000000, 453600000000000, 475200000000000, 496800000000000],
405
- dtype='timedelta64[ns]')
400
+ 172800000000000, 194400000000000, 216000000000000, 237600000000000,
401
+ 259200000000000, 280800000000000, 302400000000000, 324000000000000,
402
+ 345600000000000, 367200000000000, 388800000000000, 410400000000000,
403
+ 432000000000000, 453600000000000, 475200000000000, 496800000000000],
404
+ dtype='timedelta64[ns]')
406
405
Coordinates:
407
- * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
408
- >>> ts.dt
409
- <xarray.core.accessor_dt.TimedeltaAccessor object at 0x109a27d68 >
406
+ * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
407
+ >>> ts.dt # doctest: +ELLIPSIS
408
+ <xarray.core.accessor_dt.TimedeltaAccessor object at 0x... >
410
409
>>> ts.dt.days
411
410
<xarray.DataArray 'days' (time: 20)>
412
411
array([1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5])
413
412
Coordinates:
414
- * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
413
+ * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
415
414
>>> ts.dt.microseconds
416
415
<xarray.DataArray 'microseconds' (time: 20)>
417
416
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
418
417
Coordinates:
419
- * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
418
+ * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
420
419
>>> ts.dt.seconds
421
420
<xarray.DataArray 'seconds' (time: 20)>
422
421
array([ 0, 21600, 43200, 64800, 0, 21600, 43200, 64800, 0,
423
- 21600, 43200, 64800, 0, 21600, 43200, 64800, 0, 21600,
424
- 43200, 64800])
422
+ 21600, 43200, 64800, 0, 21600, 43200, 64800, 0, 21600,
423
+ 43200, 64800])
425
424
Coordinates:
426
- * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
425
+ * time (time) timedelta64[ns] 1 days 00:00:00 ... 5 days 18:00:00
427
426
"""
428
427
429
428
days = Properties ._tslib_field_accessor (
0 commit comments