@@ -4359,49 +4359,49 @@ def _reindex_multi(self, axes, copy, fill_value):
4359
4359
return NotImplemented
4360
4360
4361
4361
_shared_docs ['reindex_axis' ] = ("""
4362
- Conform input object to new index
4363
- with optional filling logic, placing NA/NaN in locations having
4364
- no value in the previous index. A new object is produced unless
4365
- the new index is equivalent to the current one and copy=False.
4362
+ Conform input object to new index.
4363
+
4364
+ .. deprecated:: 0.21.0
4365
+ Use `reindex` instead.
4366
+
4367
+ By default, places NaN in locations having no value in the
4368
+ previous index. A new object is produced unless the new index
4369
+ is equivalent to the current one and copy=False.
4366
4370
4367
4371
Parameters
4368
4372
----------
4369
4373
labels : array-like
4370
4374
New labels / index to conform to. Preferably an Index object to
4371
- avoid duplicating data
4375
+ avoid duplicating data.
4372
4376
axis : %(axes_single_arg)s
4377
+ Indicate whether to use rows or columns.
4373
4378
method : {None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'}, optional
4374
4379
Method to use for filling holes in reindexed DataFrame:
4375
4380
4376
- * default: don't fill gaps
4381
+ * default: don't fill gaps.
4377
4382
* pad / ffill: propagate last valid observation forward to next
4378
- valid
4379
- * backfill / bfill: use next valid observation to fill gap
4380
- * nearest: use nearest valid observations to fill gap
4383
+ valid.
4384
+ * backfill / bfill: use next valid observation to fill gap.
4385
+ * nearest: use nearest valid observations to fill gap.
4381
4386
4382
- copy : boolean, default True
4383
- Return a new object, even if the passed indexes are the same
4384
- level : int or name
4387
+ level : int or str
4385
4388
Broadcast across a level, matching Index values on the
4386
- passed MultiIndex level
4387
- limit : int, default None
4388
- Maximum number of consecutive elements to forward or backward fill
4389
- tolerance : optional
4390
- Maximum distance between original and new labels for inexact
4391
- matches. The values of the index at the matching locations most
4392
- satisfy the equation ``abs(index[indexer] - target) <= tolerance``.
4393
-
4394
- Tolerance may be a scalar value, which applies the same tolerance
4395
- to all values, or list-like, which applies variable tolerance per
4396
- element. List-like includes list, tuple, array, Series, and must be
4397
- the same size as the index and its dtype must exactly match the
4398
- index's type.
4389
+ passed MultiIndex level.
4390
+ copy : bool, default True
4391
+ Return a new object, even if the passed indexes are the same.
4392
+ limit : int, optional
4393
+ Maximum number of consecutive elements to forward or backward fill.
4394
+ fill_value : float, default NaN
4395
+ Value used to fill in locations having no value in the previous
4396
+ index.
4399
4397
4400
4398
.. versionadded:: 0.21.0 (list-like tolerance)
4401
4399
4402
4400
Returns
4403
4401
-------
4404
4402
%(klass)s
4403
+ Returns a new DataFrame object with new indices, unless the new
4404
+ index is equivalent to the current one and copy=False.
4405
4405
4406
4406
See Also
4407
4407
--------
@@ -4412,7 +4412,17 @@ def _reindex_multi(self, axes, copy, fill_value):
4412
4412
4413
4413
Examples
4414
4414
--------
4415
- >>> df.reindex_axis(['A', 'B', 'C'], axis=1)
4415
+ >>> df = pd.DataFrame({'num_legs': [4, 2], 'num_wings': [0, 2]},
4416
+ ... index=['dog', 'hawk'])
4417
+ >>> df
4418
+ num_legs num_wings
4419
+ dog 4 0
4420
+ hawk 2 2
4421
+ >>> df.reindex_axis(['num_wings', 'num_legs', 'num_heads'],
4422
+ ... axis='columns')
4423
+ num_wings num_legs num_heads
4424
+ dog 0 4 NaN
4425
+ hawk 2 2 NaN
4416
4426
""" )
4417
4427
4418
4428
@Appender (_shared_docs ['reindex_axis' ] % _shared_doc_kwargs )
0 commit comments