mars.dataframe.DataFrame.add_prefix

DataFrame.add_prefix(prefix)

Prefix labels with string prefix.

For DataFrame, the column labels are prefixed.

Parameters

prefix (str) – The string to add before each label.

Returns

New DataFrame with updated labels.

Return type

DataFrame

Examples

>>> import mars.dataframe as md
>>> df = md.DataFrame({'A': [1, 2, 3, 4], 'B': [3, 4, 5, 6]})
>>> df.execute()
    A  B
0  1  3
1  2  4
2  3  5
3  4  6
>>> df.add_prefix('col_').execute()
        col_A  col_B
0       1       3
1       2       4
2       3       5
3       4       6