NotImplementedError: > 1 ndim Categorical raised when array is read-only #15860
Labels
Compat
pandas objects compatability with Numpy or Python functions
Duplicate Report
Duplicate issue or pull request
Code Sample, a copy-pastable example if possible
In-depth look:
Problem description
If a
NumPy
array backed by a read-only buffer is used inMultiInted.from_arrays
a confuzsingNotImplementedError: > 1 ndim Categorical are not supported at this time
exception is raised.A more in-depth look at the code shows that, when using a
NumPy
array backed by a read-only buffer, theCategorical
constructor (which raises theNotImplementedError
exception) callsfactorize
which raisesValueError: buffer source array is read-only
.Maybe the read-only aspect raised by
factorize
should propagate to the user so the real cause of the exception is known. As currently implemented, theCategorical
constructor reinterprets the exception and throws a confusingNotImplementedError: > 1 ndim Categorical are not supported at this time
Expected Output
ValueError: buffer source array is read-only
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.6-100.fc24.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.utf8
LOCALE: None.None
pandas: 0.19.2
nose: 1.3.7
pip: 9.0.1
setuptools: 20.1.1
Cython: 0.25.2
numpy: 1.11.0
scipy: 0.16.1
statsmodels: None
xarray: None
IPython: 5.3.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 0.6.0
tables: 3.2.2
numexpr: 2.6.1
matplotlib: 1.5.2rc2
openpyxl: None
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: None
lxml: None
bs4: 4.4.0
html5lib: 1.0b7
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8.1
boto: 2.45.0
pandas_datareader: 0.3.0.post
The text was updated successfully, but these errors were encountered: