A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/9785 below:

Error when comparing equality of indexes · Issue #9785 · pandas-dev/pandas · GitHub

In 0.16.0 comparing MultiIndices using == raises an exception.

from StringIO import StringIO
import pandas as pd

# create a series using a multiindex
df = pd.read_csv(StringIO('a,b,c\n1,2,3'), index_col=[0, 1])
series = df['c']

series.index == series.index
#   File "/Users/dan/venvs/pandas-0.16.0/lib/python2.7/site-packages/pandas/core/index.py", line 54, in wrapper
#     func = getattr(self._data.view(np.ndarray), opname)
# AttributeError: 'NoneType' object has no attribute 'view'

print pd.__version__
#0.16.0

Another one I've come across is that there is an AttributeError when comparing indexes for which the underlying numpy arrays cannot be broadcast together. The error message itself is very obscure. I gather that .equals() can be used for what I'm trying to do in these examples, but still the errors when using == are surprising.

>>> pd.Index(['a', 'b']) == pd.Index(['a', 'b', 'c'])
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-44325051df92> in <module>()
----> 1 pd.Index(['a', 'b']) == pd.Index(['a', 'b', 'c'])

/Users/dan/venvs/pandas-0.16.0/lib/python2.7/site-packages/pandas/core/index.pyc in wrapper(self, other)
     57         # technically we could support bool dtyped Index
     58         # for now just return the indexing array directly
---> 59         if is_bool_dtype(result):
     60             return result
     61         try:

/Users/dan/venvs/pandas-0.16.0/lib/python2.7/site-packages/pandas/core/common.py in is_bool_dtype(arr_or_dtype)
   2510
   2511 def is_bool_dtype(arr_or_dtype):
-> 2512     tipo = _get_dtype_type(arr_or_dtype)
   2513     return issubclass(tipo, np.bool_)
   2514

/Users/dan/venvs/pandas-0.16.0/lib/python2.7/site-packages/pandas/core/common.py in _get_dtype_type(arr_or_dtype)
   2439     elif isinstance(arr_or_dtype, CategoricalDtype):
   2440         return CategoricalDtypeType
-> 2441     return arr_or_dtype.dtype.type
   2442
   2443

AttributeError: 'NotImplementedType' object has no attribute 'dtype'

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4