Skip to content

TST: Table doctest failures with pandas 1.1.0 #10608

Closed

Description

@pllim

pandas 1.1.0 was released about 6 hours ago. Now we see this failure "Python 3.8 with all optional dependencies" job in Travis CI initial stage.

============================= test session starts ==============================
platform linux -- Python 3.8.1, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
cachedir: .tox/py38-test-alldeps/.pytest_cache
Running tests with Astropy version 4.2.dev455+g4d853f887.
Running tests in astropy docs.
Date: 2020-07-28T19:37:45
Platform: Linux-5.3.0-1029-gcp-x86_64-with-glibc2.2.5
Executable: /home/travis/build/astropy/astropy/.tox/py38-test-alldeps/bin/python
Full Python Version: 
3.8.1 (default, Dec 20 2019, 10:06:11) 
[GCC 7.4.0]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Package versions: 
Numpy: 1.19.1
Scipy: 1.5.2
Matplotlib: 3.3.0
h5py: 2.10.0
Pandas: 1.1.0
PyERFA: 1.7.0
Using Astropy options: remote_data: none.
rootdir: /home/travis/build/astropy/astropy, inifile: setup.cfg
plugins: filter-subpackage-0.1.1, hypothesis-5.23.3, xdist-1.34.0, openfiles-0.5.0, remotedata-0.3.2, forked-1.3.0, arraydiff-0.3, cov-2.10.0, asdf-2.7.0, doctestplus-0.7.0, astropy-header-0.1.2
collected 15405 items                                                

...

=================================== FAILURES ===================================
_______________ [doctest] astropy.table.table.Table.from_pandas ________________
3487           >>> import numpy as np
3488           >>> import pandas as pd
3489           >>> from astropy.table import QTable
3490 
3491           >>> time = pd.Series(['1998-01-01', '2002-01-01'], dtype='datetime64[ns]')
3492           >>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]'))
3493           >>> df = pd.DataFrame({'time': time})
3494           >>> df['dt'] = dt
3495           >>> df['x'] = [3., 4.]
3496           >>> with pd.option_context('display.max_columns', 20):
Differences (unified diff with -expected +actual):
    @@ -1,3 +1,3 @@
    -        time       dt    x
    -0 1998-01-01 00:00:01  3.0
    -1 2002-01-01 00:05:00  4.0
    +        time              dt    x
    +0 1998-01-01 0 days 00:00:01  3.0
    +1 2002-01-01 0 days 00:05:00  4.0
/home/travis/build/astropy/astropy/.tox/py38-test-alldeps/lib/python3.8/site-packages/astropy/table/table.py:3496: DocTestFailure
________________ [doctest] astropy.table.table.Table.to_pandas _________________
3346 
3347           >>> q = [1, 2] * u.m
3348           >>> tm = Time([1998, 2002], format='jyear')
3349           >>> sc = SkyCoord([5, 6], [7, 8], unit='deg')
3350           >>> dt = TimeDelta([3, 200] * u.s)
3351 
3352           >>> t = QTable([q, tm, sc, dt], names=['q', 'tm', 'sc', 'dt'])
3353 
3354           >>> df = t.to_pandas(index='tm')
3355           >>> with pd.option_context('display.max_columns', 20):
Differences (unified diff with -expected +actual):
    @@ -1,4 +1,4 @@
    -              q  sc.ra  sc.dec       dt
    -tm
    -1998-01-01  1.0    5.0     7.0 00:00:03
    -2002-01-01  2.0    6.0     8.0 00:03:20
    +              q  sc.ra  sc.dec              dt
    +tm                                            
    +1998-01-01  1.0    5.0     7.0 0 days 00:00:03
    +2002-01-01  2.0    6.0     8.0 0 days 00:03:20
/home/travis/build/astropy/astropy/.tox/py38-test-alldeps/lib/python3.8/site-packages/astropy/table/table.py:3355: DocTestFailure

Also see pandas-dev/pandas#35463

Activity

  1. pllim commented on Jul 28, 2020

    @pllim
    MemberAuthor

    Looks like they added "N days" in? 🤷

    >>> import pandas as pd
    >>> import numpy as np
    >>> dt = pd.Series(np.array([1, 300], dtype='timedelta64[s]')) 
    >>> df = pd.DataFrame({'dt': dt})
    >>> pd.__version__
    '1.0.5'
    >>> df
            dt
    0 00:00:01
    1 00:05:00
    >>> pd.__version__
    '1.1.0'
    >>> df
                   dt
    0 0 days 00:00:01
    1 0 days 00:05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions