Skip to content
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

PERF: Faster Series construction with no data and DatetimeIndex. #11598

Merged

Conversation

lexual
Copy link
Contributor

@lexual lexual commented Nov 13, 2015

closes #11433

Code. taken from @jreback comment on #11433

asv benchmark:

    before     after       ratio
  [6c4d2c7d] [6439bd94]
-     1.68s   364.81μs      0.00  series_methods.series_constructor_no_data_datetime_index.time_series_constructor_no_data_datetime_index
SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.

@jreback jreback added Datetime Datetime data dtype Performance Memory or execution speed performance labels Nov 13, 2015
@jreback jreback added this to the 0.17.1 milestone Nov 13, 2015
@jreback
Copy link
Contributor

jreback commented Nov 13, 2015

lgtm. add a whatsnew note (perf section).
of course if you can make the code I did better / simplier, pls do so.

@jreback
Copy link
Contributor

jreback commented Nov 13, 2015

ping when note added, ready, and green.

@lexual lexual force-pushed the issue_11433_slow_series_construct_no_values branch 2 times, most recently from d5e44b4 to 18715b0 Compare November 13, 2015 22:26
@lexual
Copy link
Contributor Author

lexual commented Nov 14, 2015

done, done, and done ;)

elif isinstance(index, PeriodIndex):
data = [data.get(i, nan) for i in index]
if len(data):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make these 1-liners (and in except
data = [ data.get(i, np.nan) for i in index ] if len(data) else np.nan

@jreback
Copy link
Contributor

jreback commented Nov 14, 2015

minor comments, ping when green.

@lexual lexual force-pushed the issue_11433_slow_series_construct_no_values branch from 18715b0 to 20511dd Compare November 15, 2015 00:51
@lexual
Copy link
Contributor Author

lexual commented Nov 15, 2015

changes made, waiting for Travis again

@lexual
Copy link
Contributor Author

lexual commented Nov 15, 2015

green. ping @jreback

jreback added a commit that referenced this pull request Nov 15, 2015
…ct_no_values

PERF: Faster Series construction with no data and DatetimeIndex.
@jreback jreback merged commit 67b1355 into pandas-dev:master Nov 15, 2015
@jreback
Copy link
Contributor

jreback commented Nov 15, 2015

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series(index=DatetimeIndex(...)) constructor very slow
2 participants