-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: constructing a DataFrame using range doesn't work #26343
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
BUG: constructing a DataFrame using range doesn't work #26343
Conversation
Hello @topper-123! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-05-12 12:19:28 UTC |
502b1f3
to
e0f3e54
Compare
expected = DataFrame([list(range(10)), list(range(10))]) | ||
result = DataFrame([range(10), range(10)]) |
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.
A plain range
isn't a iterator, so this fixes up the nomenclature.
The range case is now placed in test_constructor_list_of_ranges
, which is clearer.
Codecov Report
@@ Coverage Diff @@
## master #26343 +/- ##
==========================================
- Coverage 92.04% 92.03% -0.01%
==========================================
Files 175 175
Lines 52292 52292
==========================================
- Hits 48133 48128 -5
- Misses 4159 4164 +5
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #26343 +/- ##
==========================================
- Coverage 92.04% 92.03% -0.01%
==========================================
Files 175 175
Lines 52292 52292
==========================================
- Hits 48132 48128 -4
- Misses 4160 4164 +4
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -258,7 +258,10 @@ Performance Improvements | |||
Bug Fixes | |||
~~~~~~~~~ | |||
|
|||
DataFrame | |||
^^^^^^^^^^^ |
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.
Too many "^" (just enough to funderline DataFrame
)
doc/source/whatsnew/v0.25.0.rst
Outdated
|
||
- Fixed a bug where Constructing a :class:`DataFrame` using a ``range`` (e.g. ``pd.DataFrame(range(3))``) would cause an ``AttributeException`` (:issue:`26342`). |
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.
I think you meant AttributeError
tm.assert_frame_equal(result, expected) | ||
|
||
def test_constructor_list_of_ranges(self): | ||
result = DataFrame([range(10), range(10)]) |
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.
I would reference the issue as a comment above this line as well.
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.
Oh, this is just an existing test that has been moved. It already passed before this PR.
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.
Will need to wait on fixing the Windows build, but the patch looks good!
cc @jreback
i will comment later |
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -258,7 +258,10 @@ Performance Improvements | |||
Bug Fixes | |||
~~~~~~~~~ | |||
|
|||
DataFrame |
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.
just put this in the reshaping section, don't create a new one
doc/source/whatsnew/v0.25.0.rst
Outdated
|
||
- Fixed a bug where Constructing a :class:`DataFrame` using a ``range`` (e.g. ``pd.DataFrame(range(3))``) would cause an ``AttributeException`` (:issue:`26342`). |
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.
Bug in construction of a :class:`DataFrame`
using a range
object (:issue:....)
no need to be more verbose; we rarely mention the original error received
6332b6c
to
48bc320
Compare
48bc320
to
96706f0
Compare
This passes now. |
thanks @topper-123 |
git diff upstream/master -u -- "*.py" | flake8 --diff
Fixes bug when constructing a
DataFrame
using arange
.