ENH: Let initialisation from dicts use insertion order for python >= 3.6 (part I)#19830
Merged
jreback merged 1 commit intopandas-dev:masterfrom Feb 23, 2018
Merged
ENH: Let initialisation from dicts use insertion order for python >= 3.6 (part I)#19830jreback merged 1 commit intopandas-dev:masterfrom
jreback merged 1 commit intopandas-dev:masterfrom
Conversation
Contributor
|
seems fine. small comments. ping on green. |
Codecov Report
@@ Coverage Diff @@
## master #19830 +/- ##
==========================================
+ Coverage 91.58% 91.61% +0.03%
==========================================
Files 150 150
Lines 48908 48892 -16
==========================================
+ Hits 44792 44793 +1
+ Misses 4116 4099 -17
Continue to review full report at Codecov.
|
Contributor
Author
|
Green. |
jreback
requested changes
Feb 22, 2018
| datetime64name: 1, objectname: 1}) | ||
| result.sort_index() | ||
| expected.sort_index() | ||
| result.sort_index(inplace=True) |
Contributor
There was a problem hiding this comment.
can you reassign, I hate inplace
| expected[floatname] = 1 | ||
|
|
||
| result.sort_index() | ||
| result.sort_index(inplace=True) |
735e66c to
77a5347
Compare
77a5347 to
d677f94
Compare
jreback
approved these changes
Feb 22, 2018
Contributor
|
lgtm ping on green |
Contributor
|
thanks |
This was referenced Feb 23, 2018
harisbal
pushed a commit
to harisbal/pandas
that referenced
this pull request
Feb 28, 2018
4 tasks
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
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.
git diff upstream/master -u -- "*.py" | flake8 --diffThis PR prepares pandas to allow initialisation using insertion order for python>=3.6. E.g.
Series({'B': 1, 'A': 2})will then retain order and not convert toSeries({'A': 2, 'B': 1}).Letting dataframe/series initialisation from dicts preserve order for python >=3.6 is a relative simple change, just change a line each in core/frame.py and core/series.py. However, this makes some 36 tests fail, as the tests have been set up to depend on conversion to alphabetical order.
This PR makes all tests in
pandas/tests/framepass both if dict initialisation uses insertion order and alphabetical order. No test functionality is changed in this PR.After this PR I will do 1 or 2 more similar PRs, so all tests pass independent of dict initialisation rule, and then core/frame.py and core/series.py will be changed to use insertion order for python>=3.6.