Skip to content

Test for tests\indexes\datetimes\test_tools.py fails  #26696

Closed
@topper-123

Description

@topper-123

I'm getting an error when running the tests suite. I've locatet the relevant PR to be #26585.

It is failing on my machine, but not on the CI, so I assume some configuration differences. I'm on a Windows machine, which could be the relevant difference. See my cinfuíguration at the bottom of this issue.

================================================================= FAILURES ==================================================================
______________________ TestTimeConversionFormats.test_int_to_datetime_format_YYYYMMDD_typeerror[2012010101-2012010101] ______________________

self = <pandas.tests.indexes.datetimes.test_tools.TestTimeConversionFormats object at 0x000002950CC92E80>, int_date = 2012010101
expected = 2012010101

    @pytest.mark.parametrize('int_date, expected', [
        # valid date, length == 8
        [20121030, datetime(2012, 10, 30)],
        # short valid date, length == 6
        [199934, datetime(1999, 3, 4)],
        # long integer date partially parsed to datetime(2012,1,1), length > 8
        [2012010101, 2012010101],
        # invalid date partially parsed to datetime(2012,9,9), length == 8
        [20129930, 20129930],
        # short integer date partially parsed to datetime(2012,9,9), length < 8
        [2012993, 2012993],
        # short invalid date, length == 4
        [2121, 2121]])
    def test_int_to_datetime_format_YYYYMMDD_typeerror(self, int_date,
                                                       expected):
        # GH 26583
>       result = to_datetime(int_date, format='%Y%m%d', errors='ignore')

pandas\tests\indexes\datetimes\test_tools.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas\util\_decorators.py:188: in wrapper
    return func(*args, **kwargs)
pandas\core\tools\datetimes.py:626: in to_datetime
    result = convert_listlike(np.array([arg]), box, format)[0]
pandas\core\tools\datetimes.py:270: in _convert_listlike_datetimes
    arg, format, exact=exact, errors=errors)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   val[found.end():])
E   TypeError: 'int' object is unsliceable

pandas\_libs\tslibs\strptime.pyx:149: TypeError
________________________ TestTimeConversionFormats.test_int_to_datetime_format_YYYYMMDD_typeerror[20129930-20129930] ________________________

self = <pandas.tests.indexes.datetimes.test_tools.TestTimeConversionFormats object at 0x000002950D025C18>, int_date = 20129930
expected = 20129930

    @pytest.mark.parametrize('int_date, expected', [
        # valid date, length == 8
        [20121030, datetime(2012, 10, 30)],
        # short valid date, length == 6
        [199934, datetime(1999, 3, 4)],
        # long integer date partially parsed to datetime(2012,1,1), length > 8
        [2012010101, 2012010101],
        # invalid date partially parsed to datetime(2012,9,9), length == 8
        [20129930, 20129930],
        # short integer date partially parsed to datetime(2012,9,9), length < 8
        [2012993, 2012993],
        # short invalid date, length == 4
        [2121, 2121]])
    def test_int_to_datetime_format_YYYYMMDD_typeerror(self, int_date,
                                                       expected):
        # GH 26583
>       result = to_datetime(int_date, format='%Y%m%d', errors='ignore')

pandas\tests\indexes\datetimes\test_tools.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas\util\_decorators.py:188: in wrapper
    return func(*args, **kwargs)
pandas\core\tools\datetimes.py:626: in to_datetime
    result = convert_listlike(np.array([arg]), box, format)[0]
pandas\core\tools\datetimes.py:270: in _convert_listlike_datetimes
    arg, format, exact=exact, errors=errors)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   val[found.end():])
E   TypeError: 'int' object is unsliceable

pandas\_libs\tslibs\strptime.pyx:149: TypeError
_________________________ TestTimeConversionFormats.test_int_to_datetime_format_YYYYMMDD_typeerror[2012993-2012993] _________________________

self = <pandas.tests.indexes.datetimes.test_tools.TestTimeConversionFormats object at 0x000002950CEC7908>, int_date = 2012993
expected = 2012993

    @pytest.mark.parametrize('int_date, expected', [
        # valid date, length == 8
        [20121030, datetime(2012, 10, 30)],
        # short valid date, length == 6
        [199934, datetime(1999, 3, 4)],
        # long integer date partially parsed to datetime(2012,1,1), length > 8
        [2012010101, 2012010101],
        # invalid date partially parsed to datetime(2012,9,9), length == 8
        [20129930, 20129930],
        # short integer date partially parsed to datetime(2012,9,9), length < 8
        [2012993, 2012993],
        # short invalid date, length == 4
        [2121, 2121]])
    def test_int_to_datetime_format_YYYYMMDD_typeerror(self, int_date,
                                                       expected):
        # GH 26583
>       result = to_datetime(int_date, format='%Y%m%d', errors='ignore')

pandas\tests\indexes\datetimes\test_tools.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas\util\_decorators.py:188: in wrapper
    return func(*args, **kwargs)
pandas\core\tools\datetimes.py:626: in to_datetime
    result = convert_listlike(np.array([arg]), box, format)[0]
pandas\core\tools\datetimes.py:270: in _convert_listlike_datetimes
    arg, format, exact=exact, errors=errors)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   val[found.end():])
E   TypeError: 'int' object is unsliceable

pandas\_libs\tslibs\strptime.pyx:149: TypeError
================================================= 3 failed, 394 deselected in 2.40 seconds ==================================================

INSTALLED VERSIONS

commit: 649ad5c
python: 3.7.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.25.0.dev0+616.g7f0a7435e
pytest: 4.3.0
pip: 18.1
setuptools: 40.6.2
Cython: 0.29
numpy: 1.16.4
scipy: 1.1.0
pyarrow: 0.11.1
xarray: None
IPython: 7.5.0
sphinx: 1.8.2
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: 3.5.1
numexpr: 2.6.8
feather: None
matplotlib: 3.0.1
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: None
lxml.etree: 4.3.3
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions