-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Bug: exporting data frames to excel using xlsxwriter with option cons… #22502
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: exporting data frames to excel using xlsxwriter with option cons… #22502
Conversation
…tant_memory set to true, most of the cells are empty. Now raises NotImlementedError. #15392
Codecov Report
@@ Coverage Diff @@
## master #22502 +/- ##
=======================================
Coverage 92.04% 92.04%
=======================================
Files 169 169
Lines 50776 50776
=======================================
Hits 46737 46737
Misses 4039 4039
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.24.0.txt
Outdated
@@ -671,6 +671,7 @@ Missing | |||
- Bug in :func:`DataFrame.fillna` where a ``ValueError`` would raise when one column contained a ``datetime64[ns, tz]`` dtype (:issue:`15522`) | |||
- Bug in :func:`Series.hasnans` that could be incorrectly cached and return incorrect answers if null elements are introduced after an initial call (:issue:`19700`) | |||
- :func:`Series.isin` now treats all nans as equal also for `np.object`-dtype. This behavior is consistent with the behavior for float64 (:issue:`22119`) | |||
- Bug in: class:`ExcelWriter` where exporting data frames to excel using xlsxwriter with option constant_memory set to true, most of the cells are empty. Now raises NotImlementedError. (:issue:`15392`) | |||
|
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.
- data frame -->
DataFrames
(with backticks) - excel -->
Excel
- double backticks around
xlsxwriter
- backticks around
constant_memory
- true -->
True
(double with backticks) - double backticks around
NotImplementedError
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.
@bryanfree66 : Could you address all of these comments as well?
pandas/tests/io/test_excel.py
Outdated
@@ -1831,6 +1831,13 @@ def test_comment_used(self, merge_cells, engine, ext): | |||
result = read_excel(self.path, 'test_c', comment='#') | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
def test_constant_memory_option_raises_NotImplementedError(self, engine): | |||
df = DataFrame({'a': ['1', '2'], 'b': ['2', '3']}) | |||
with pytest.raises(NotImplementedError): |
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.
Use tm.assert_raises_regex
to also check error message, where tm
is pandas.util.testing
.
pandas/tests/io/test_excel.py
Outdated
@@ -1831,6 +1831,13 @@ def test_comment_used(self, merge_cells, engine, ext): | |||
result = read_excel(self.path, 'test_c', comment='#') | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
def test_constant_memory_option_raises_NotImplementedError(self, engine): | |||
df = DataFrame({'a': ['1', '2'], 'b': ['2', '3']}) |
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.
Reference issue number above this line.
…ed error message per code review.
Updated pull request to reference issue number on test and assert raised error message. Thanks @gfyoung. |
Codecov Report
@@ Coverage Diff @@
## master #22502 +/- ##
=========================================
Coverage ? 92.03%
=========================================
Files ? 169
Lines ? 50780
Branches ? 0
=========================================
Hits ? 46737
Misses ? 4043
Partials ? 0
Continue to review full report at Codecov.
|
pandas/tests/io/test_excel.py
Outdated
@@ -1831,6 +1831,15 @@ def test_comment_used(self, merge_cells, engine, ext): | |||
result = read_excel(self.path, 'test_c', comment='#') | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
# RE issue # 15392 |
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.
Move issue number reference under the def...
line.
this needs a more generic soln |
I can take a crack at writing the data row-by-row to fix the issue. It might be a little complex, but i can probably have something in a few days. |
Closing as stale. Ping if you'd like to pick it back up |
…tant_memory set to true, most of the cells are empty. Now raises NotImlementedError. #15392
git diff upstream/master -u -- "*.py" | flake8 --diff