bach.DataFrame.rename
rename
(mapper=None, index=None, columns=None, axis=0, level=None, errors='ignore')Rename columns.
The interface is similar to Panda’s pandas.DataFrame.rename()
. However we don’t support
renaming indexes, so recommended usage is rename(columns=...)
.
Parameters
mapper
(Optional[Union[Dict[str, str], Callable[[str], str]]]) – dict to apply to that axis’ values. Use mapper and axis to specify the axis to target with mapper. Currently mapper is only supported withaxis=1
, which is similar to using columns.index
(Optional[Union[Dict[str, str], Callable[[str], str]]]) – not supported.columns
(Optional[Union[Dict[str, str], Callable[[str], str]]]) – dict str:str to rename columns, or a function that takes column names as an argument and returns the new one. The new column names must not clash with other column names in eitherself.
data
orself.
index
, after renaming is complete.axis
(int) –axis=1
is supported, rest is not.level
(Optional[int]) – not supportederrors
(str) – Either ‘ignore’ or ‘raise’. When set to ‘ignore’ KeyErrors about non-existing column names incolumns
ormapper
are ignored. Errors thrown in the mapper function or about invalid target column names are not suppressed.
Returns
DataFrame with the renamed axis labels.
Return type
note
The copy parameter is not supported since it makes very little sense for db backed series.