@@ -1300,6 +1300,7 @@ def set_names(self, names, level=None, inplace=False):
1300
1300
Int64Index([1, 2, 3, 4], dtype='int64', name='foo')
1301
1301
>>> pd.Index([1, 2, 3, 4]).set_names(['foo'])
1302
1302
Int64Index([1, 2, 3, 4], dtype='int64', name='foo')
1303
+
1303
1304
>>> idx = pd.MultiIndex.from_tuples([(1, u'one'), (1, u'two'),
1304
1305
(2, u'one'), (2, u'two')],
1305
1306
names=['foo', 'bar'])
@@ -1311,6 +1312,10 @@ def set_names(self, names, level=None, inplace=False):
1311
1312
MultiIndex(levels=[[1, 2], [u'one', u'two']],
1312
1313
labels=[[0, 0, 1, 1], [0, 1, 0, 1]],
1313
1314
names=[u'baz', u'bar'])
1315
+
1316
+ See also
1317
+ --------
1318
+ rename : able to set new names without level
1314
1319
"""
1315
1320
1316
1321
from .multi import MultiIndex
@@ -1359,6 +1364,7 @@ def rename(self, name, inplace=False):
1359
1364
Int64Index([1, 2, 3, 4], dtype='int64', name='foo')
1360
1365
>>> idx.rename('bar')
1361
1366
Int64Index([1, 2, 3, 4], dtype='int64', name='bar')
1367
+
1362
1368
>>> idx = MultiIndex.from_tuples([(1, u'one'), (1, u'two'),
1363
1369
(2, u'one'), (2, u'two')],
1364
1370
names=['foo', 'bar'])
0 commit comments