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

array_equivalent has disappeared from pandas.core.common in version 0.19, is this a mistake? #14555

Open
cleemesser opened this Issue Nov 2, 2016 · 7 comments

Comments

Projects
None yet
4 participants
@cleemesser

cleemesser commented Nov 2, 2016

A small, complete example of the issue

# Your code here
import pandas
import pandas.core.common as com
print com.array_equivalent

Expected Output

# expect something like:
# <function array_equivalent at 0x000000000445A198>
# But I get
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-fc6fc07906df> in <module>()
----> 1 print com.array_equivalent

AttributeError: 'module' object has no attribute 'array_equivalent'

Output of pd.show_versions()

# Paste the output here pd.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 2.7.11.final.0 python-bits: 64 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: None.None

pandas: 0.19.0
nose: 1.3.7
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.1.2
sphinx: 1.3.5
patsy: 0.4.0
dateutil: 2.5.1
pytz: 2016.2
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.6.1
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.6.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.39.0
pandas_datareader: None

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Nov 2, 2016

Contributor

you can import it from pandas.types.missing. its not really a public method. though @jorisvandenbossche and I did have this discussion.

Contributor

jreback commented Nov 2, 2016

you can import it from pandas.types.missing. its not really a public method. though @jorisvandenbossche and I did have this discussion.

@jorisvandenbossche

This comment has been minimized.

Show comment
Hide comment
@jorisvandenbossche

jorisvandenbossche Nov 2, 2016

Member

Well, there are two aspect about this:

First, that we didn't add a deprecation warning for array_equivalent (as we did for the other functions in pd.core.common. This can be easily fixed.

Secondly about the fact that we currently don't plan to make this public (opposed to other functions in pd.core.common), and so it is not recommended to use it (although you can now import it from pd.types.missing, we don't guarantee this will keep working).
But if it is regarded as useful functionality, we can consider to making it public.

Member

jorisvandenbossche commented Nov 2, 2016

Well, there are two aspect about this:

First, that we didn't add a deprecation warning for array_equivalent (as we did for the other functions in pd.core.common. This can be easily fixed.

Secondly about the fact that we currently don't plan to make this public (opposed to other functions in pd.core.common), and so it is not recommended to use it (although you can now import it from pd.types.missing, we don't guarantee this will keep working).
But if it is regarded as useful functionality, we can consider to making it public.

@tomspur

This comment has been minimized.

Show comment
Hide comment
@tomspur

tomspur Nov 2, 2016

array_equivalent is already used in the docs, which fails now with a traceback:
image

tomspur commented Nov 2, 2016

array_equivalent is already used in the docs, which fails now with a traceback:
image

@jorisvandenbossche

This comment has been minimized.

Show comment
Hide comment
@jorisvandenbossche

jorisvandenbossche Nov 2, 2016

Member

@tomspur yes, we are aware of that (and I forgot to remove it from the docs for the 0.19.0 release)

Member

jorisvandenbossche commented Nov 2, 2016

@tomspur yes, we are aware of that (and I forgot to remove it from the docs for the 0.19.0 release)

@jorisvandenbossche

This comment has been minimized.

Show comment
Hide comment
@jorisvandenbossche

jorisvandenbossche Nov 2, 2016

Member

This functionality should actually be rather available from numpy. The problem is, however, that np.array_equal or np.array_equiv do not handle NaNs well.
But I see that numpy 1.10 added a equal_nan keyword to np.allclose, so you can do:

>>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
True

https://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html

We can probably recommend that as alternative

Member

jorisvandenbossche commented Nov 2, 2016

This functionality should actually be rather available from numpy. The problem is, however, that np.array_equal or np.array_equiv do not handle NaNs well.
But I see that numpy 1.10 added a equal_nan keyword to np.allclose, so you can do:

>>> np.allclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
True

https://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html

We can probably recommend that as alternative

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Nov 2, 2016

Contributor

i don't think that handles object dtypes (with or w/o nans)

Contributor

jreback commented Nov 2, 2016

i don't think that handles object dtypes (with or w/o nans)

@jorisvandenbossche

This comment has been minimized.

Show comment
Hide comment
@jorisvandenbossche

jorisvandenbossche Nov 2, 2016

Member

Ah, yes, and also no datetime64 values. OK, clearly not a full replacement

Member

jorisvandenbossche commented Nov 2, 2016

Ah, yes, and also no datetime64 values. OK, clearly not a full replacement

@jreback jreback added the API Design label Nov 2, 2016

dukebody added a commit to scikit-learn-contrib/sklearn-pandas that referenced this issue Aug 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment