Skip to content

KeyError on master in TestExcelWrtiter #22595

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
TomAugspurger opened this issue Sep 4, 2018 · 2 comments · Fixed by #22889
Closed

KeyError on master in TestExcelWrtiter #22595

TomAugspurger opened this issue Sep 4, 2018 · 2 comments · Fixed by #22889
Labels
IO Excel read_excel, to_excel Testing pandas testing functions or related to the test suite
Milestone

Comments

@TomAugspurger
Copy link
Contributor

https://travis-ci.org/pandas-dev/pandas/jobs/424485100 isn't master, but it's seeminglyon other PRs. e.g. https://travis-ci.org/pandas-dev/pandas/jobs/424480841#L2253

______________ TestExcelWriter.test_tsframe[openpyxl-.xlsx-True] _______________
[gw0] darwin -- Python 3.5.6 /Users/travis/miniconda3/envs/pandas/bin/python
self = <pandas.tests.io.test_excel.TestExcelWriter object at 0x1148ad9b0>
merge_cells = True, engine = 'openpyxl', ext = '.xlsx'
    def test_tsframe(self, merge_cells, engine, ext):
        df = tm.makeTimeDataFrame()[:5]
    
>       df.to_excel(self.path, 'test1')
pandas/tests/io/test_excel.py:1153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pandas/core/frame.py:1749: in to_excel
    engine=engine)
pandas/io/formats/excel.py:658: in write
    freeze_panes=freeze_panes)
pandas/io/excel.py:1419: in write_cells
    xcell.value, fmt = self._value_with_fmt(cell.val)
../../../miniconda3/envs/pandas/lib/python3.5/site-packages/openpyxl/cell/cell.py:291: in value
    self._bind_value(value)
../../../miniconda3/envs/pandas/lib/python3.5/site-packages/openpyxl/cell/cell.py:193: in _bind_value
    self._set_time_format(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <Cell 'test1'.A2>, value = Timestamp('2000-01-03 00:00:00', freq='B')
    def _set_time_format(self, value):
        """Set number format for Python date or time"""
        fmts = {
            datetime.datetime:numbers.FORMAT_DATE_DATETIME,
            datetime.date:numbers.FORMAT_DATE_YYYYMMDD2,
            datetime.time:numbers.FORMAT_DATE_TIME6,
            datetime.timedelta:numbers.FORMAT_DATE_TIMEDELTA,
                }
>       self.number_format = fmts[type(value)]
E       KeyError: <class 'pandas._libs.tslibs.timestamps.Timestamp'>

Trying to reproduce locally now.

@gfyoung gfyoung added Testing pandas testing functions or related to the test suite IO Excel read_excel, to_excel labels Sep 5, 2018
gfyoung added a commit to forking-repos/pandas that referenced this issue Sep 5, 2018
2.5.5 --> 2.5.6 broke compatibility
with pandas Timestamp objects.

Closes pandas-devgh-22595.
@gfyoung
Copy link
Member

gfyoung commented Sep 5, 2018

FYI, someone has just filed an issue on Bitbucket:

https://bitbucket.org/openpyxl/openpyxl/issues/1094/error-with-pandas-datetimeindex

TomAugspurger pushed a commit that referenced this issue Sep 5, 2018
2.5.5 --> 2.5.6 broke compatibility
with pandas Timestamp objects.

Closes gh-22595.
aeltanawy pushed a commit to aeltanawy/pandas that referenced this issue Sep 20, 2018
2.5.5 --> 2.5.6 broke compatibility
with pandas Timestamp objects.

Closes pandas-devgh-22595.
@jreback jreback added this to the 0.24.0 milestone Sep 30, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this issue Oct 1, 2018
2.5.5 --> 2.5.6 broke compatibility
with pandas Timestamp objects.

Closes pandas-devgh-22595.
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 Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants