-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ExcelWriter fails with columns with int32 dtype #3122
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
Comments
I think Excel writer needs to do some type conversions as xlwt only seems to deal with pure python types |
prob can get done in 0.12 |
In data giovedì 21 marzo 2013 07:41:18, jreback ha scritto:
No big deal. I noticed it seems to work if I upcast to int64. Luca Beltrame - KDE Forums team |
FYI...this actually wasn't a bug in 0.10.1 because the astype that you are doing, while converting the series, upcasted again when put back in the data frame (but in 0.11 the dtype in the frame is correct) so going to leave open for fixing later
|
I'm thinking we create a function that, based on numpy version/environment, converts columns to things that are picked up as int/float/long and that will be used by the cell formatter. Does int64 need to be special-cased to long in 32 bit python? |
this I think is an excel conversion issue in that it doesn't know how to deal with int32 |
@jtratner I think it's the other way around - since we normally always use int64 wrt the python version |
@jreback well, it just needs to be converted to a format that's a subclass of int/float/whatever. |
so in 32bit python int32 is a subclass of int, in 64bit python int64 is a subclass of int. |
ok so this IS platform dep on the windows side then? weird |
@jreback not sure...I'm just going off of what that guy showed was happening in the linked issue |
@lbeltrame - very soon you can use the |
cc @jmcnamara, does xlxswriter handle |
Xlsxwriter will handle
So, The reason that it fails with a |
ok...leaving open as their needs to be a conversion done for xlwt |
In def _conv_value(val):
# convert value for excel dump
if isinstance(val, np.int64):
val = int(val)
elif isinstance(val, np.bool8):
val = bool(val)
elif isinstance(val, Period):
val = "%s" % val
return val Changing it to something like would fix this issue (although there may be other cases to account for as well):
|
@jmcnamara absolutely...... do a PR for that? (maybe use |
@jreback Ok. I'll write a test and do a PR. |
closed by #5122 |
Test case
The text was updated successfully, but these errors were encountered: