-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix DataFrame construction regression #22232
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
Conversation
pandas/tests/generic/test_frame.py
Outdated
'Ohio': {2000: 1.5, 2001: 1.7, 2002: 3.6}} | ||
result = pd.DataFrame(pop, index=[2001, 2002, 2003], columns=columns) | ||
expected = pd.DataFrame( | ||
{'Nevada': [2.4, 2.9, np.nan], 'Ohio': [1.7, 3.6, np.nan]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to construct this with a list of lists? Would put an extra safeguard in place in case of something wonky going on with dict construction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments. ping on green.
pandas/tests/generic/test_frame.py
Outdated
@@ -268,3 +268,15 @@ def test_deepcopy_empty(self): | |||
empty_frame_copy = deepcopy(empty_frame) | |||
|
|||
self._compare(empty_frame_copy, empty_frame) | |||
|
|||
def test_nested_dict_construction(self): | |||
columns = ['Nevada', 'Ohio'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the gh as a comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pandas/tests/generic/test_frame.py
Outdated
|
||
def test_nested_dict_construction(self): | ||
columns = ['Nevada', 'Ohio'] | ||
pop = {'Nevada': {2001: 2.4, 2002: 2.9}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move to pandas/tests/frame/test_construction instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@WillAyd would you mind pushing a 0.23.5 empty whatsnew? |
lgtm. let's leave on 0.24, can think about backporting. |
doc/source/whatsnew/v0.24.0.txt
Outdated
|
||
- Constructing a DataFrame with an index argument that wasn't already an | ||
instance of :class:`~pandas.core.Index` was broken in `4efb39f | ||
<https://github.com/pandas-dev/pandas/commit/4efb39f01f5880122fa38d91e12d217ef70fad9e>`_ (:issue:`22227`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we created a separate Regressions
section in the whatsnew
? Generally, we just put regression bugs in the bugs section and don't "call out" the offending commits like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, keeping track of the number of regressions over time is an important indicator of stability of a project. I think pandas is fairly stable with respect to regression, and I think it's important that we know how often regressions are happening.
The specific commit is there for minimizing the number of clicks someone has to perform to see exactly what code introduced the regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so actually 0.23.5 whatsnew is now pushed, let backport this, can you move the whatsnew. ping when pushed
@jreback Pushed |
Codecov Report
@@ Coverage Diff @@
## master #22232 +/- ##
==========================================
+ Coverage 92.06% 92.06% +<.01%
==========================================
Files 169 169
Lines 50698 50699 +1
==========================================
+ Hits 46676 46677 +1
Misses 4022 4022
Continue to review full report at Codecov.
|
thanks @cpcloud |
git diff upstream/master -u -- "*.py" | flake8 --diff