Skip to content

COMPAT: recent numpy deprecation warnings #19116

@jreback

Description

@jreback

getting lots of deprecation warnings from numpy.

(pandas) bash-3.2$ pytest pandas/tests/test_resample.py pandas/tests/io/json/test_json_table_schema.py 
============================================================================================================ test session starts ============================================================================================================
platform darwin -- Python 3.6.3, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
rootdir: /Users/jreback/pandas, inifile: setup.cfg
plugins: xdist-1.20.1, forked-0.2, cov-2.5.1, hypothesis-3.38.5
collected 350 items                                                                                                                                                                                                                         

pandas/tests/test_resample.py ...................................................................................................................ssss................................................................................ [ 56%]
...............................ssss..................................                                                                                                                                                                 [ 76%]
pandas/tests/io/json/test_json_table_schema.py ...................................................x..x..x..x..xxxx..x..x..X..X...                                                                                                     [100%]

============================================================================================================= warnings summary ==============================================================================================================
pandas/tests/io/json/test_json_table_schema.py::TestTableOrientReader::()::test_read_json_table_orient[vals2-None]
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)

pandas/tests/io/json/test_json_table_schema.py::TestTableOrientReader::()::test_read_json_table_orient[vals2-idx]
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)

pandas/tests/io/json/test_json_table_schema.py::TestTableOrientReader::()::test_read_json_table_orient[vals2-index]
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)

pandas/tests/io/json/test_json_table_schema.py::TestTableOrientReader::()::test_comprehensive
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)
  /Users/jreback/pandas/pandas/core/dtypes/cast.py:706: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
    return arr.astype(dtype)

-- Docs: http://doc.pytest.org/en/latest/warnings.html
================================================================================ 330 passed, 8 skipped, 10 xfailed, 2 xpassed, 16 warnings in 12.85 seconds =================================================================================
In [1]: arr = np.array(['2016-01-01T00:00:00.000Z', '2016-01-02T00:00:00.000Z',
   ...:        '2016-01-03T00:00:00.000Z', '2016-01-04T00:00:00.000Z'], dtype=object)
   ...: 

In [2]: arr.astype('<M8[ns]')
/Users/jreback/miniconda3/envs/pandas/bin/ipython:1: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
  #!/Users/jreback/miniconda3/envs/pandas/bin/python
Out[2]: 
array(['2016-01-01T00:00:00.000000000', '2016-01-02T00:00:00.000000000',
       '2016-01-03T00:00:00.000000000', '2016-01-04T00:00:00.000000000'], dtype='datetime64[ns]')

I haven't seen these before, so a recent change must have triggered

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functionsDatetimeDatetime data dtypeTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions