Skip to content

CLN/PERF: simplify tslib.get_time_micros #18389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 24, 2017
Merged
Changes from 1 commit
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
Next Next commit
simplify get_time_micros
  • Loading branch information
jbrockmendel committed Nov 20, 2017
commit fd8718b837cd8d590728a919fbac077d0402ef79
10 changes: 1 addition & 9 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1704,17 +1704,9 @@ def get_time_micros(ndarray[int64_t] dtindex):
Datetime as int64 representation to a structured array of fields
"""
cdef:
Py_ssize_t i, n = len(dtindex)
pandas_datetimestruct dts
ndarray[int64_t] micros

micros = np.empty(n, dtype=np.int64)

for i in range(n):
dt64_to_dtstruct(dtindex[i], &dts)
micros[i] = 1000000LL * (dts.hour * 60 * 60 +
60 * dts.min + dts.sec) + dts.us

micros = np.mod(dtindex, 86_400_000_000_000, dtype=np.int64) // 1000LL
return micros


Expand Down