Closed
Description
Code Sample
In Pandas version 0.20, The documentation for the function pandas.MultiIndex.rename
includes an "Examples" section with five lines of Python code.
Here are the examples:
>>> Index([1, 2, 3, 4]).set_names('foo')
Int64Index([1, 2, 3, 4], dtype='int64')
>>> Index([1, 2, 3, 4]).set_names(['foo'])
Int64Index([1, 2, 3, 4], dtype='int64')
>>> idx = MultiIndex.from_tuples([(1, u'one'), (1, u'two'),
(2, u'one'), (2, u'two')],
names=['foo', 'bar'])
>>> idx.set_names(['baz', 'quz'])
MultiIndex(levels=[[1, 2], [u'one', u'two']],
labels=[[0, 0, 1, 1], [0, 1, 0, 1]],
names=[u'baz', u'quz'])
>>> idx.set_names('baz', level=0)
MultiIndex(levels=[[1, 2], [u'one', u'two']],
labels=[[0, 0, 1, 1], [0, 1, 0, 1]],
names=[u'baz', u'bar'])
Problem description
The examples do not call the MultiIndex.rename
function. Expected contents of the documentation: the examples given for the rename
function should actually call the rename
function.
Output of pd.show_versions()
N/A, documentation bug.
Meta note
The link above will begin pointing at documentation for a different version of Pandas once the successor to version 0.20 is released as a stable version. Unfortunately, there is no link to version 0.20 documentation per se on the pandas homepage.