Skip to content

to_excel with engine='xlwt' doesn't support pandas.tslib.Timedelta #9155

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
s-celles opened this issue Dec 26, 2014 · 4 comments · Fixed by #19244
Closed

to_excel with engine='xlwt' doesn't support pandas.tslib.Timedelta #9155

s-celles opened this issue Dec 26, 2014 · 4 comments · Fixed by #19244
Labels
IO Excel read_excel, to_excel Timedelta Timedelta data type
Milestone

Comments

@s-celles
Copy link
Contributor

Hello,

to_excel method with engine='xlwt' doesn't support pandas.tslib.Timedelta

import numpy as np
import pandas as pd

idx = pd.date_range('20140101', '20140201')
df = pd.DataFrame(index=idx)
df['col0'] = np.random.randn(len(idx))
s_idx = pd.Series(idx, index=idx)
diff_idx = (s_idx-s_idx.shift(1)).fillna(pd.Timedelta(0))
df['diff_dt'] = diff_idx
df.to_excel("out.xls", engine='xlwt')

it works fine with xlsx files (engine openpyxl or xlsxwriter).

Kind regards

@jreback jreback added IO Excel read_excel, to_excel Timedelta Timedelta data type labels Dec 26, 2014
@jreback
Copy link
Contributor

jreback commented Dec 26, 2014

showing the versions is always helpful (pd.show_versions()).

@s-celles
Copy link
Contributor Author

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Darwin
OS-release: 14.0.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: fr_FR.UTF-8

pandas: 0.15.2
nose: 1.3.4
Cython: 0.21.1
numpy: 1.9.1
scipy: 0.14.1rc1
statsmodels: 0.6.1
IPython: 2.3.1
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.3
pytz: 2014.9
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: 2.0.3
xlrd: 0.9.3
xlwt: 0.7.5
xlsxwriter: 0.6.4
lxml: 3.4.1
bs4: 4.3.2
html5lib: 0.999
httplib2: 0.8
apiclient: None
rpy2: None
sqlalchemy: 0.9.8
pymysql: 0.6.2.None
psycopg2: None

@shoyer
Copy link
Member

shoyer commented Jan 2, 2015

@scls19fr does this work with the plain datetime.timedelta type instead of pd.Timedelta? This might be another case where Timedelta does not quite conform to the timedelta API.

@alexbw
Copy link

alexbw commented May 5, 2015

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants