Skip to content
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

engine xlsxwriter fails for np.inf #6782

Closed
arthurgerigk-rocket opened this issue Apr 3, 2014 · 8 comments

Comments

Projects
None yet
4 participants
@arthurgerigk-rocket
Copy link

commented Apr 3, 2014

this works for openpyxl but it fails for xlsxwriter

TypeError("NAN/INF not supported in write_number()")

@jreback

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2014

do nans raise the same? or just inf?

@jreback jreback added Bug labels Apr 3, 2014

@jreback jreback added this to the 0.15.0 milestone Apr 3, 2014

@jreback

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2014

@arthurgerigk-rocket

This comment has been minimized.

Copy link
Author

commented Apr 3, 2014

nans are fine

On Thu, Apr 3, 2014 at 7:19 PM, jreback notifications@github.com wrote:

cc @jmcnamara https://github.com/jmcnamara

Reply to this email directly or view it on GitHubhttps://github.com//issues/6782#issuecomment-39478741
.

Arthur Gerigk
Global CMO

Rocket Internet GmbH | Johannisstraße 20 | 10117 Berlin | Deutschland
Mobile: +49 162 290 46 39 | skype: arthur.gerigk | mail:
arthur.gerigk@rocket-internet.de
www.rocket-internet.de

Geschäftsführer: Dr. Johannes Bruder, Arnt Jeschke, Alexander Kudlich
Eingetragen beim Amtsgericht Berlin, HRB 109262 USt-ID DE256469659

@jmcnamara

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2014

I don't think NAN/INF are supported by Excel so I am curious to see what OpenPyXL is doing in this case.

Can you post a small example that demonstrates the issue and I'll look into it.

@arthurgerigk-rocket

This comment has been minimized.

Copy link
Author

commented Apr 3, 2014

to_excel has a parameter "na_rep" which defaults to the empty string.
actually there are NA values in excel
http://office.microsoft.com/en-001/excel-help/na-HP005209188.aspx

On Thu, Apr 3, 2014 at 7:39 PM, John McNamara notifications@github.comwrote:

I don't think NAN/INF are supported by Excel so I am curious to see what
OpenPyXL is doing in this case.

Can you post a small example that demonstrates the issue and I'll look
into it.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6782#issuecomment-39481271
.

Arthur Gerigk
Global CMO

Rocket Internet GmbH | Johannisstraße 20 | 10117 Berlin | Deutschland
Mobile: +49 162 290 46 39 | skype: arthur.gerigk | mail:
arthur.gerigk@rocket-internet.de
www.rocket-internet.de

Geschäftsführer: Dr. Johannes Bruder, Arnt Jeschke, Alexander Kudlich
Eingetragen beim Amtsgericht Berlin, HRB 109262 USt-ID DE256469659

@jmcnamara

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2014

NA is only supported in Excel as a formula or as the result of a formula. Not as a value.

If you post an example I'll have a look at it.

@arthurgerigk-rocket

This comment has been minimized.

Copy link
Author

commented Apr 3, 2014

import numpy as np
import pandas as pd
df = pd.DataFrame([(1, np.nan), (2, 3)])
df.to_excel('test.xlsx') # works

df = pd.DataFrame([(1, np.inf), (2, 3)])
df.to_excel('test2.xlsx') # fails

since there is a parameter np_rep I think it has to work ;-)

On Thu, Apr 3, 2014 at 8:14 PM, John McNamara notifications@github.comwrote:

NA is only supported in Excel as a formula or as the result of a formula.
Not as a value.

If you post an example I'll have a look at it.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6782#issuecomment-39485412
.

Arthur Gerigk
Global CMO

Rocket Internet GmbH | Johannisstraße 20 | 10117 Berlin | Deutschland
Mobile: +49 162 290 46 39 | skype: arthur.gerigk | mail:
arthur.gerigk@rocket-internet.de
www.rocket-internet.de

Geschäftsführer: Dr. Johannes Bruder, Arnt Jeschke, Alexander Kudlich
Eingetragen beim Amtsgericht Berlin, HRB 109262 USt-ID DE256469659

@jtratner

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2014

Let's follow the model of to_csv/read_csv and output np.inf as the string 'inf', which will be able to be round-tripped appropriately.

Side note - I can't open up the openpyxl file after it's written - so I'm not sure if openpyxl is doing the right thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.