MultiIndex.from_product throws on read-only array (original) (raw)
Code Sample, a copy-pastable example if possible
import numpy as np import pandas as pd a = np.array(range(3)) b = ['a', 'b']
Succeeds, as expected
pd.MultiIndex.from_product([a, b]) a.setflags(write=False)
Raises a ValueError with "buffer source array is read-only"
pd.MultiIndex.from_product([a, b])
Problem description
Nothing in the MultiIndex.from_product documentation suggests the inputs need to be mutable. Moreover, it is surprising that the arguments are being mutated.
Expected Output
Not raising.
Output of pd.show_versions()
DetailsINSTALLED VERSIONS ------------------ commit: None python: 3.5.2.final.0 python-bits: 64 OS: Linux OS-release: 4.1.17-pv-ts1 machine: x86_64 processor: byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8
pandas: 0.19.2-ts2
nose: 1.3.7
pip: 9.0.1
setuptools: 27.2.0
Cython: None
numpy: 1.11.3
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: 1.5.1
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.4
boto: None
pandas_datareader: None