Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4f8af44

Browse files
committedSep 13, 2014
ENH: TimedeltaIndex and Timedelta scalar support (GH3009)
BUG: coercion of timedeltas in assignment (GH8209) COMPAT: provide conversion for passing in non-ns datetime64/timedelta64 BUG: diff on Dataframe with timedelta64 broken (GH4533) ENH: support for alternate Timedelta format constructors in natural language (GH8190) BUG: handle empty timedelta64[ns] Series with ops (GH7869)
1 parent e1cd966 commit 4f8af44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+5304
-1639
lines changed
 

‎doc/source/api.rst

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ Top-level missing data
146146
isnull
147147
notnull
148148

149-
Top-level dealing with datetimes
150-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149+
Top-level dealing with datetimelike
150+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151151

152152
.. autosummary::
153153
:toctree: generated/
@@ -157,6 +157,7 @@ Top-level dealing with datetimes
157157
date_range
158158
bdate_range
159159
period_range
160+
timedelta_range
160161

161162
Top-level evaluation
162163
~~~~~~~~~~~~~~~~~~~~
@@ -440,13 +441,16 @@ Time series-related
440441

441442
Datetimelike Properties
442443
~~~~~~~~~~~~~~~~~~~~~~~
444+
443445
``Series.dt`` can be used to access the values of the series as
444446
datetimelike and return several properties.
445447
Due to implementation details the methods show up here as methods of the
446-
``DatetimeProperties/PeriodProperties`` classes. These can be accessed like ``Series.dt.<property>``.
448+
``DatetimeProperties/PeriodProperties/TimedeltaProperties`` classes. These can be accessed like ``Series.dt.<property>``.
447449

448450
.. currentmodule:: pandas.tseries.common
449451

452+
**Datetime Properties**
453+
450454
.. autosummary::
451455
:toctree: generated/
452456

@@ -473,6 +477,37 @@ Due to implementation details the methods show up here as methods of the
473477
DatetimeProperties.is_year_start
474478
DatetimeProperties.is_year_end
475479

480+
**Datetime Methods**
481+
482+
.. autosummary::
483+
:toctree: generated/
484+
485+
DatetimeProperties.to_period
486+
DatetimeProperties.to_pydatetime
487+
DatetimeProperties.tz_localize
488+
DatetimeProperties.tz_convert
489+
490+
**Timedelta Properties**
491+
492+
.. autosummary::
493+
:toctree: generated/
494+
495+
TimedeltaProperties.days
496+
TimedeltaProperties.hours
497+
TimedeltaProperties.minutes
498+
TimedeltaProperties.seconds
499+
TimedeltaProperties.milliseconds
500+
TimedeltaProperties.microseconds
501+
TimedeltaProperties.nanoseconds
502+
TimedeltaProperties.components
503+
504+
**Timedelta Methods**
505+
506+
.. autosummary::
507+
:toctree: generated/
508+
509+
TimedeltaProperties.to_pytimedelta
510+
476511
String handling
477512
~~~~~~~~~~~~~~~
478513
``Series.str`` can be used to access the values of the series as
@@ -1289,6 +1324,37 @@ Conversion
12891324
DatetimeIndex.to_pydatetime
12901325
DatetimeIndex.to_series
12911326

1327+
TimedeltaIndex
1328+
--------------
1329+
1330+
.. autosummary::
1331+
:toctree: generated/
1332+
1333+
TimedeltaIndex
1334+
1335+
Components
1336+
~~~~~~~~~~
1337+
1338+
.. autosummary::
1339+
:toctree: generated/
1340+
1341+
TimedeltaIndex.days
1342+
TimedeltaIndex.hours
1343+
TimedeltaIndex.minutes
1344+
TimedeltaIndex.seconds
1345+
TimedeltaIndex.milliseconds
1346+
TimedeltaIndex.microseconds
1347+
TimedeltaIndex.nanoseconds
1348+
TimedeltaIndex.components
1349+
1350+
Conversion
1351+
~~~~~~~~~~
1352+
.. autosummary::
1353+
:toctree: generated/
1354+
1355+
TimedeltaIndex.to_pytimedelta
1356+
TimedeltaIndex.to_series
1357+
12921358
GroupBy
12931359
-------
12941360
.. currentmodule:: pandas.core.groupby

‎doc/source/basics.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,16 @@ This enables nice expressions like this:
11221122
11231123
s[s.dt.day==2]
11241124
1125+
You can easily produces tz aware transformations:
1126+
1127+
.. ipython:: python
1128+
1129+
stz = s.dt.tz_localize('US/Eastern')
1130+
stz
1131+
stz.dt.tz
1132+
1133+
The ``.dt`` accessor works for period and timedelta dtypes.
1134+
11251135
.. ipython:: python
11261136
11271137
# period
@@ -1130,6 +1140,15 @@ This enables nice expressions like this:
11301140
s.dt.year
11311141
s.dt.day
11321142
1143+
.. ipython:: python
1144+
1145+
# timedelta
1146+
s = Series(timedelta_range('1 day 00:00:05',periods=4,freq='s'))
1147+
s
1148+
s.dt.days
1149+
s.dt.seconds
1150+
s.dt.components
1151+
11331152
.. note::
11341153

11351154
``Series.dt`` will raise a ``TypeError`` if you access with a non-datetimelike values

0 commit comments

Comments
 (0)
Please sign in to comment.