-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Render empty DataFrame as empty HTML table w/o raising IndexError. #16441
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
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.
@JimStearns206 thanks. Whatsnew can go in doc/source/whatsnew/v0.20.2.txt
Just a minor request for a couple more edge cases. The fix looks good though.
@@ -103,6 +103,12 @@ def test_render(self): | |||
s.render() | |||
# it worked? | |||
|
|||
def test_render_empty_df(self): | |||
empty_df = 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.
You can add a link to the issue here if you want https://github.com/pandas-dev/pandas/issues/15953
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.
Could you also add a couple checks with
- an index but on columns
- columns but no index
It can be as simple as DataFrame(columns=['a']).style.render()
and DataFrame(index=['a']).style.render()
Codecov Report
@@ Coverage Diff @@
## master #16441 +/- ##
==========================================
+ Coverage 90.42% 90.42% +<.01%
==========================================
Files 161 161
Lines 51023 51024 +1
==========================================
+ Hits 46138 46139 +1
Misses 4885 4885
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16441 +/- ##
==========================================
+ Coverage 90.42% 90.42% +<.01%
==========================================
Files 161 161
Lines 51023 51024 +1
==========================================
+ Hits 46138 46139 +1
Misses 4885 4885
Continue to review full report at Codecov.
|
@JimStearns206 whoops looks like there were some extra commits in there. Are you on gitter? I can walk you through rebasing if you want. |
Basic idea is to
|
DataFrame with an index but no column, and one with a column but no index. Add entry to whatsnew.
Thanks! |
…r. (pandas-dev#16441) * BUG: Render empty DataFrame as empty HTML table w/o raising IndexError. * TST: Test rendering of 2 empty-ish DataFrames (pandas-dev#15953) DataFrame with an index but no column, and one with a column but no index. Add entry to whatsnew. (cherry picked from commit d9a63d0)
…r. (pandas-dev#16441) * BUG: Render empty DataFrame as empty HTML table w/o raising IndexError. * TST: Test rendering of 2 empty-ish DataFrames (pandas-dev#15953) DataFrame with an index but no column, and one with a column but no index. Add entry to whatsnew.
git diff upstream/master --name-only -- '*.py' | flake8 --diff
A one line change to add an
if clabels
guard to clabels enumeration.Returns HTML string consisting of empty table.
Help requested with format and placement of whatsnew entry.