Skip to content

COMPAT: recent numpy deprecation warnings #19116

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
jreback opened this issue Jan 7, 2018 · 8 comments · Fixed by #19176 or #19232
Closed

COMPAT: recent numpy deprecation warnings #19116

jreback opened this issue Jan 7, 2018 · 8 comments · Fixed by #19176 or #19232
Labels
Compat pandas objects compatability with Numpy or Python functions Datetime Datetime data dtype Timezones Timezone data dtype
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Jan 7, 2018

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

@jreback jreback added Compat pandas objects compatability with Numpy or Python functions Datetime Datetime data dtype Timezones Timezone data dtype labels Jan 7, 2018
@jreback jreback added this to the 0.23.0 milestone Jan 7, 2018
@jreback
Copy link
Contributor Author

jreback commented Jan 7, 2018

cc @jbrockmendel cc @jschendel cc @WillAyd

@WillAyd
Copy link
Member

WillAyd commented Jan 8, 2018

Just ran on upstream/master and did not get any warnings - are we running the same version?

pd.show_versions()

INSTALLED VERSIONS

commit: 16d0262
python: 3.6.3.final.0
python-bits: 64
OS: Darwin
OS-release: 17.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.0.dev0+79.g16d026212
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.5.0.post20170921
Cython: 0.26.1
numpy: 1.13.3
scipy: 1.0.0
pyarrow: 0.8.0
xarray: 0.10.0
IPython: 6.2.1
sphinx: 1.6.3
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: 0.4.0
matplotlib: 2.1.1
openpyxl: 2.5.0b1
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.1.13
pymysql: 0.7.11.None
psycopg2: None
jinja2: 2.10
s3fs: 0.1.2
fastparquet: 0.1.3
pandas_gbq: None
pandas_datareader: None

@jreback
Copy link
Contributor Author

jreback commented Jan 8, 2018

export PANDAS_TESTING_MODE=deprecate
first ; DeprecationWarnings are normally suppressed
we enable them in CI

@WillAyd
Copy link
Member

WillAyd commented Jan 8, 2018

Hmm OK. It appears the line

pd.date_range('2016-01-01', freq='d', periods=4)

Is triggering this within the tests. Not immediately apparent to me why that would be the case but will take a look

@WillAyd
Copy link
Member

WillAyd commented Jan 8, 2018

So it looks like write_json is outputting the date range in the format that you provided above. Are we on the same page that we would have to change that behavior to support this?

@chris-b1
Copy link
Contributor

chris-b1 commented Jan 8, 2018

This is without digging into the json code, but I suspect rather than changing the output format, we should instead replace uses of numpy conversion .astype(<datetime>) with our internal parser pd.to_datetime(...)

@gfyoung
Copy link
Member

gfyoung commented Jan 8, 2018

Odd how this is case, since I think that warning was created partially in response to pandas:

https://github.com/numpy/numpy/blob/2bacec9ecb0fc665117a22027b73812509a99f56/doc/release/1.11.0-notes.rst#compatibility-notes

@jreback
Copy link
Contributor Author

jreback commented Jan 13, 2018

shoot. #19224 reversed this :<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Datetime Datetime data dtype Timezones Timezone data dtype
Projects
None yet
4 participants