pandas.DataFrame.add_suffix() function with example program in python
pandas.DataFrame.add_suffix() : This function Suffix labels with string suffix.
Syntax: DataFrame.add_suffix(suffix)
For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed.
Parameters:
suffix : str
The string to add after each label.
Returns:
Series or DataFrame
New Series or DataFrame with updated labels.
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 2], 'b': [30, 40, 50]})
print(df.add_suffix('test'))
Output:
atest btest 0 1 30 1 2 40 2 2 50