def rename_axis(self, mapper, axis=0, copy=True): """ Alter index and / or columns using input function or functions. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Parameters ---------- mapper : dict-like or function, optional axis : int, default 0 copy : boolean, default True Also copy underlying data See also -------- DataFrame.rename Returns ------- renamed : type of caller """ # should move this at some point from pandas.core.series import _get_rename_function mapper_f = _get_rename_function(mapper) axis = self._get_axis_number(axis) if axis == 0: new_data = self._data.rename_items(mapper_f, copydata=copy) else: new_data = self._data.rename_axis(mapper_f, axis=axis) if copy: new_data = new_data.copy() return self._constructor(new_data)
def rename_axis(self, mapper, axis=0, copy=True): """ Alter index and / or columns using input function or functions. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Parameters ---------- mapper : dict-like or function, optional axis : int, default 0 copy : boolean, default True Also copy underlying data See also -------- DataFrame.rename Returns ------- renamed : type of caller """ # should move this at some point from pandas.core.series import _get_rename_function mapper_f = _get_rename_function(mapper) if axis == 0: new_data = self._data.rename_items(mapper_f, copydata=copy) else: new_data = self._data.rename_axis(mapper_f, axis=axis) if copy: new_data = new_data.copy() return self._constructor(new_data)