File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,9 @@ class Index(IndexOpsMixin, PandasObject):
362362 An Index instance can **only** contain hashable objects.
363363 An Index instance *can not* hold numpy float16 dtype.
364364
365+ The `names` argument is only relevant when the data results in a `MultiIndex`.
366+ When constructing a regular `Index`, use `name=` to assign a name. Passing `names=` will have no effect unless a `MultiIndex` is created.
367+
365368 Examples
366369 --------
367370 >>> pd.Index([1, 2, 3])
@@ -372,8 +375,15 @@ class Index(IndexOpsMixin, PandasObject):
372375
373376 >>> pd.Index([1, 2, 3], dtype="uint8")
374377 Index([1, 2, 3], dtype='uint8')
378+
379+ >>> pd.Index([], name='a').name
380+ 'a'
381+
382+ >>> pd.Index([], names=['a']).name is None
383+ True
375384 """
376385
386+
377387 # similar to __array_priority__, positions Index after Series and DataFrame
378388 # but before ExtensionArray. Should NOT be overridden by subclasses.
379389 __pandas_priority__ = 2000
You can’t perform that action at this time.
0 commit comments