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()
Comment From: jreback
you can import it from pandas.types.missing
. its not really a public method. though @jorisvandenbossche and I did have this discussion.
Comment From: jorisvandenbossche
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.
Comment From: tomspur
array_equivalent
is already used in the docs, which fails now with a traceback:
Comment From: jorisvandenbossche
@tomspur yes, we are aware of that (and I forgot to remove it from the docs for the 0.19.0 release)
Comment From: jorisvandenbossche
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
Comment From: jreback
i don't think that handles object dtypes (with or w/o nans)
Comment From: jorisvandenbossche
Ah, yes, and also no datetime64 values. OK, clearly not a full replacement
Comment From: jbrockmendel
Is this actionable? Closeable?
Comment From: jorisvandenbossche
The core.common
deprecations have already been removed before. And there has been no further discussion (or requests) to make array_equivalent
public, so closing.