You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to set an index using a Period rather than a Datetime,
the performance significantly deteriorates. A small example:
import pandas as pa
obs = 1000
start_date = '1/1/1900'
df = pa.DataFrame(list(range(1, obs + 1)))
df['dateindex'] = pa.date_range('1/1/1900', periods=obs, freq='M')
df['periodindex'] = pa.period_range('1/1/1900', periods=obs, freq='M')
%timeit df.set_index('dateindex')
#1000 loops, best of 3: 444 µs per loop
%timeit df.set_index('periodindex')
#1000 loops, best of 3: 1.89 ms per loop
This difference in performance becomes especially frustrating with
larger dataframes. In order for Period to be as useful as Datetime,
these should be much closer in performance.
The text was updated successfully, but these errors were encountered:
When attempting to set an index using a Period rather than a Datetime,
the performance significantly deteriorates. A small example:
This difference in performance becomes especially frustrating with
larger dataframes. In order for Period to be as useful as Datetime,
these should be much closer in performance.
The text was updated successfully, but these errors were encountered: