Skip to content

version 0.23: RangeIndex argument order changed, docs stale #22373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikapfl opened this issue Aug 15, 2018 · 2 comments · Fixed by #36606
Closed

version 0.23: RangeIndex argument order changed, docs stale #22373

mikapfl opened this issue Aug 15, 2018 · 2 comments · Fixed by #36606
Labels
Milestone

Comments

@mikapfl
Copy link

mikapfl commented Aug 15, 2018

>>> 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

@gfyoung gfyoung added the Docs label Aug 19, 2018
@gfyoung gfyoung added this to the 0.23.5 milestone Aug 19, 2018
@gfyoung
Copy link
Member

gfyoung commented Aug 19, 2018

@mikapfl : Good catch! Feel free to update the documentation.

Marking for 0.23.5 because this looks like a broken doc from 0.22.0 to 0.23.0.

@mikapfl
Copy link
Author

mikapfl commented Aug 19, 2018

@gfyoung: First time contributing to pandas, I hope my changes look good. I split it up into many patches, only the first two are needed to fix this specific bug if you want a minimal changeset for 0.23.5.

@jreback jreback modified the milestones: 0.23.5, 0.24.0 Oct 23, 2018
@jreback jreback modified the milestones: 0.24.0, Contributions Welcome Dec 2, 2018
jbrockmendel added a commit to jbrockmendel/pandas that referenced this issue Sep 24, 2020
@jbrockmendel jbrockmendel mentioned this issue Sep 24, 2020
6 tasks
@jreback jreback modified the milestones: Contributions Welcome, 1.2 Sep 24, 2020
jbrockmendel added a commit that referenced this issue Sep 28, 2020
* docstring fixups, closes #26982

* update RangeIndex docstring, closes #22373

* CLN: misc

* CLN: update Makefil

* update nat docstrings to match

* revert controversial
kesmit13 pushed a commit to kesmit13/pandas that referenced this issue Nov 2, 2020
* docstring fixups, closes pandas-dev#26982

* update RangeIndex docstring, closes pandas-dev#22373

* CLN: misc

* CLN: update Makefil

* update nat docstrings to match

* revert controversial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants