MCPcopy
hub / github.com/pandas-dev/pandas / _reindex_multi

Method _reindex_multi

pandas/core/frame.py:5766–5789  ·  view source on GitHub ↗

We are guaranteed non-Nones in the axes.

(self, axes: dict[str, Index], fill_value)

Source from the content-addressed store, hash-verified

5764 # Reindexing and alignment
5765
5766 def _reindex_multi(self, axes: dict[str, Index], fill_value) -> DataFrame:
5767 """
5768 We are guaranteed non-Nones in the axes.
5769 """
5770
5771 new_index, row_indexer = self.index.reindex(axes["index"])
5772 new_columns, col_indexer = self.columns.reindex(axes["columns"])
5773
5774 if row_indexer is not None and col_indexer is not None:
5775 # Fastpath. By doing two 'take's at once we avoid making an
5776 # unnecessary copy.
5777 # We only get here with `self._can_fast_transpose`, which (almost)
5778 # ensures that self.values is cheap. It may be worth making this
5779 # condition more specific.
5780 indexer = row_indexer, col_indexer
5781 new_values = take_2d_multi(self.values, indexer, fill_value=fill_value)
5782 return self._constructor(
5783 new_values, index=new_index, columns=new_columns, copy=False
5784 )
5785 else:
5786 return self._reindex_with_indexers(
5787 {0: [new_index, row_indexer], 1: [new_columns, col_indexer]},
5788 fill_value=fill_value,
5789 )
5790
5791 def set_axis(
5792 self,

Callers

nothing calls this directly

Calls 4

_constructorMethod · 0.95
take_2d_multiFunction · 0.90
reindexMethod · 0.45

Tested by

no test coverage detected