Return an array of formatted strings specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in `python string format doc <https://docs.python.org/3/library/datetime.html#strftime-strpt
(self, date_format: str)
| 352 | """ |
| 353 | |
| 354 | def strftime(self, date_format: str) -> T_DataArray: |
| 355 | """ |
| 356 | Return an array of formatted strings specified by date_format, which |
| 357 | supports the same string format as the python standard library. Details |
| 358 | of the string format can be found in `python string format doc |
| 359 | <https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior>`__ |
| 360 | |
| 361 | Parameters |
| 362 | ---------- |
| 363 | date_format : str |
| 364 | date format string (e.g. "%Y-%m-%d") |
| 365 | |
| 366 | Returns |
| 367 | ------- |
| 368 | formatted strings : same type as values |
| 369 | Array-like of strings formatted for each element in values |
| 370 | |
| 371 | Examples |
| 372 | -------- |
| 373 | >>> import datetime |
| 374 | >>> rng = xr.Dataset({"time": datetime.datetime(2000, 1, 1)}) |
| 375 | >>> rng["time"].dt.strftime("%B %d, %Y, %r") |
| 376 | <xarray.DataArray 'strftime' ()> Size: 8B |
| 377 | array('January 01, 2000, 12:00:00 AM', dtype=object) |
| 378 | """ |
| 379 | obj_type = type(self._obj) |
| 380 | |
| 381 | result = _strftime(self._obj.data, date_format) |
| 382 | |
| 383 | return obj_type( |
| 384 | result, name="strftime", coords=self._obj.coords, dims=self._obj.dims |
| 385 | ) |
| 386 | |
| 387 | def isocalendar(self) -> Dataset: |
| 388 | """Dataset containing ISO year, week number, and weekday. |
no test coverage detected