Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Bug: exporting data frames to excel using xlsxwriter with option cons… #22502

wants to merge 3 commits into from

Conversation

bryanfree66
Copy link

@bryanfree66 bryanfree66 commented Aug 24, 2018

…tant_memory set to true, most of the cells are empty. Now raises NotImlementedError. #15392

…tant_memory set to true, most of the cells are empty. Now raises NotImlementedError. #15392
@codecov
Copy link

codecov bot commented Aug 25, 2018

Codecov Report

Merging #22502 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22502   +/-   ##
=======================================
  Coverage   92.04%   92.04%           
=======================================
  Files         169      169           
  Lines       50776    50776           
=======================================
  Hits        46737    46737           
  Misses       4039     4039
Flag Coverage Δ
#multiple 90.45% <ø> (ø) ⬆️
#single 42.23% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55d176d...bb9db22. Read the comment docs.

@gfyoung gfyoung added Error Reporting Incorrect or improved errors from pandas IO Excel read_excel, to_excel labels Aug 25, 2018
@@ -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`)

Copy link
Member

@gfyoung gfyoung Aug 25, 2018

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

Copy link
Member

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?

@@ -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):
Copy link
Member

@gfyoung gfyoung Aug 25, 2018

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.

@@ -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']})
Copy link
Member

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.

@bryanfree66
Copy link
Author

Updated pull request to reference issue number on test and assert raised error message. Thanks @gfyoung.

@codecov
Copy link

codecov bot commented Aug 25, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@55d176d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #22502   +/-   ##
=========================================
  Coverage          ?   92.03%           
=========================================
  Files             ?      169           
  Lines             ?    50780           
  Branches          ?        0           
=========================================
  Hits              ?    46737           
  Misses            ?     4043           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.44% <ø> (?)
#single 42.22% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55d176d...5a50ad9. Read the comment docs.

@@ -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
Copy link
Member

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.

@jreback
Copy link
Contributor

jreback commented Aug 25, 2018

this needs a more generic soln

@bryanfree66
Copy link
Author

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.

@WillAyd
Copy link
Member

WillAyd commented Nov 23, 2018

Closing as stale. Ping if you'd like to pick it back up

@WillAyd WillAyd closed this Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.to_excel with xlsxwriter and constant_memory makes most of the cells empty
4 participants