-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Study on refactoring the series constructor #57952
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
Closed
aureliobarbosa
wants to merge
97
commits into
pandas-dev:main
from
aureliobarbosa:refactor_series_constructor
Closed
Study on refactoring the series constructor #57952
aureliobarbosa
wants to merge
97
commits into
pandas-dev:main
from
aureliobarbosa:refactor_series_constructor
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… equals float('nan')
…ow _init_non_empty_dict()
… to the less restrictive case. With comments.
…_list_like on data manipulation
… who don't. Copy if needed.
…ating the manager
…p explicit on copy
…ASK 2). Step 2.1.1
…ASK 2). Step 2.1.2
…ecouple warnings and data manipulations.
…x logic is dtype independent.
…plifying logic. Step 2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This is an study on refactoring the series constructor, with emphasis on two points:
In particular, it should noticed that data manipulation on dictionaries and series data were duplicate and it was possible to eliminate the function
self._init_dict()
by reusing logic used to create series objects from other series.Another interesting point is that, after refactoring, it became evident that the current code uses twice as much memory for manipulating dictionaries, as opposed to lists, with the same data set (tests were done locally with 10 million random numbers). In this case, it is possible to reduce the memory usage while creating the Series with dictionaries by up to 25% by avoiding the creation of a tuple from dictionary keys.
As mentioned above, this is an study and the main objective of this PR is to check if tests passes on all platforms.
Nevertheless, if any core member can take a look on it, I would be glad to receive a feedback.
If the community decide that any idea introduced here are useful for integration in the main branch, I would be glad to take them from this work and do separate PR with them.
P.S.: This branch diverged a little bit from main, but the only changes introduced so far were related to #57889. Those changes were incorporated on this PR.
Regards
EDIT: typo and P.S.