Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.17.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Removal of prior version deprecations/changes
Performance Improvements
~~~~~~~~~~~~~~~~~~~~~~~~

- Improved ``Series.resample`` performance with dtype=datetime64[ns] (:issue:`7754`)

.. _whatsnew_0170.bug_fixes:

Bug Fixes
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,8 @@ def aggregate(self, values, how, axis=0):

if is_datetime_or_timedelta_dtype(values.dtype):
values = values.view('int64')
# GH 7754
is_numeric = True
elif is_bool_dtype(values.dtype):
values = _algos.ensure_float64(values)
elif com.is_integer_dtype(values):
Expand Down
10 changes: 10 additions & 0 deletions vb_suite/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ def date_range(start=None, end=None, periods=None, freq=None):
Benchmark("ts.resample('D', how='mean')", setup,
start_date=datetime(2012, 4, 25))

# GH 7754
setup = common_setup + """
rng = date_range(start='2000-01-01 00:00:00',
end='2000-01-01 10:00:00', freq='555000U')
int_ts = Series(5, rng, dtype='int64')
ts = int_ts.astype('datetime64[ns]')
"""

timeseries_resample_datetime64 = Benchmark("ts.resample('1S', how='last')", setup)

#----------------------------------------------------------------------
# to_datetime

Expand Down