Skip to content

COMPAT: IntegerXXDtypes string repr cause numpy deprecation warnings #24593

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
jorisvandenbossche opened this issue Jan 3, 2019 · 6 comments · Fixed by #24541
Closed

COMPAT: IntegerXXDtypes string repr cause numpy deprecation warnings #24593

jorisvandenbossche opened this issue Jan 3, 2019 · 6 comments · Fixed by #24541
Labels
Dtype Conversions Unexpected or buggy dtype conversions ExtensionArray Extending pandas with custom dtypes or arrays.
Milestone

Comments

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Jan 3, 2019

The 'numeric-style' type codes are deprecated in numpy, but they clash with our pandas integer dtypes strings (with the capital):

In [7]: np.dtype('Int64')                                     
/home/joris/miniconda3/envs/dev/bin/ipython:1: DeprecationWarning: Numeric-style type codes are deprecated and will result in an error in the future.
  #!/home/joris/miniconda3/envs/dev/bin/python
Out[7]: dtype('int64')

This causes some deprecation warnings in pd.core.dtypes.common._get_dtype_type, which surfaces those through eg is_integer_dtype:

In [1]: import warnings                                      

In [2]: warnings.simplefilter('always', DeprecationWarning)

In [3]: pd.api.types.pandas_dtype('Int64')                                                
Out[3]: <pandas.core.arrays.integer.Int64Dtype at 0x7fa8dc28c518>

In [4]: pd.core.dtypes.common._get_dtype_type('Int64')                                             
/home/joris/scipy/pandas/pandas/core/dtypes/common.py:1864: DeprecationWarning: Numeric-style type codes are deprecated and will result in an error in the future.
  return _get_dtype_type(np.dtype(arr_or_dtype))
Out[4]: numpy.int64

In [6]: pd.api.types.is_integer_dtype('Int64')                         
/home/joris/scipy/pandas/pandas/core/dtypes/common.py:1864: DeprecationWarning: Numeric-style type codes are deprecated and will result in an error in the future.
  return _get_dtype_type(np.dtype(arr_or_dtype))
Out[6]: True
@jorisvandenbossche jorisvandenbossche added this to the 0.24.0 milestone Jan 3, 2019
@jorisvandenbossche
Copy link
Member Author

"Strange" thing here is that this is not being raised on the numpy-dev build on Azure, which should be failing when there are uncatched numpy warnings (so either there is a reason that they are not raised there, or there is a problem with the "fail-on-warning" mode)

@TomAugspurger
Copy link
Contributor

Do you know what test this is hit in?

It's possible that the warnings are being elevated to errors in the numpydev build, but whatever code is calling this may be catching the exception.

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions ExtensionArray Extending pandas with custom dtypes or arrays. labels Jan 3, 2019
@jorisvandenbossche
Copy link
Member Author

Would still be good to investigate why Azure dev build was not failing.

@TomAugspurger do you remember on what is is supposed to fail? On any warning? Or only DeprecationWarning/FutureWarnings? Only from specific packages? Or only from pandas?

It is a bit fishy that in the azure build there is no warning at all, while in all travis builds there are plenty of warnings (both from numpy and pandas). Which seems to indicate that just no warnings are reported at all with pytest on azure.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jan 4, 2019 via email

@jorisvandenbossche
Copy link
Member Author

It's running pytest -m "not single and not slow and not network", so I would find that strange. Although maybe a lot of tests are skipped if no optional dependencies are installed

@jorisvandenbossche
Copy link
Member Author

Although maybe a lot of tests are skipped if no optional dependencies are installed

Which might be the case, as only numpy ans scipy are installed (so no plotting, not any optional IO, ..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants