Description
>>> import pandas as pd
>>> pd.__version__
'0.23.4'
>>> pd.RangeIndex(0, 3, 1, 'name')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mpfluege/.local/miniconda3/envs/pitchwalk/lib/python3.7/site-packages/pandas/core/indexes/range.py", line 74, in __new__
cls._validate_dtype(dtype)
File "/home/mpfluege/.local/miniconda3/envs/pitchwalk/lib/python3.7/site-packages/pandas/core/indexes/range.py", line 161, in _validate_dtype
if not (dtype is None or is_int64_dtype(dtype)):
File "/home/mpfluege/.local/miniconda3/envs/pitchwalk/lib/python3.7/site-packages/pandas/core/dtypes/common.py", line 991, in is_int64_dtype
tipo = _get_dtype_type(arr_or_dtype)
File "/home/mpfluege/.local/miniconda3/envs/pitchwalk/lib/python3.7/site-packages/pandas/core/dtypes/common.py", line 1872, in _get_dtype_type
return _get_dtype_type(np.dtype(arr_or_dtype))
TypeError: data type "name" not understood
Problem description
Documentation of RangeIndex states that it has the arguments start
, stop
, step
, name
and copy
. However, the actual signature is RangeIndex(start=None, stop=None, step=None, dtype=None, copy=False, name=None, fastpath=False)
, which has dtype
as fourth argument. This breaks scripts that relied on the fourth argument being the name, which used to be the case:
>>> import pandas as pd
>>> pd.__version__
'0.22.0'
>>> pd.RangeIndex(0, 3, 1, 'name')
RangeIndex(start=0, stop=3, step=1, name='name')
Expected Output
Either revert to the old argument order or at least update the documentation.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.140-62-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: de_DE.UTF-8
LOCALE: de_DE.UTF-8
pandas: 0.23.4
pytest: None
pip: 10.0.1
setuptools: 40.0.0
Cython: None
numpy: 1.15.0
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: 2.6.7
feather: None
matplotlib: 2.2.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None