mindspore.dataset.Dataset.rename
- Dataset.rename(input_columns, output_columns)[source]
Rename the columns in input datasets.
- Parameters
- Returns
Dataset, dataset renamed.
Examples
>>> import mindspore.dataset as ds >>> input_columns = ["input_col1", "input_col2", "input_col3"] >>> output_columns = ["output_col1", "output_col2", "output_col3"] >>> >>> # Create a dataset with 3 columns >>> dataset = ds.GeneratorDataset([(1, 2, 3), (3, 4, 5), (5, 6, 7)], column_names=input_columns) >>> >>> # Rename "input_col1" to "output_col1", "input_col2" to "output_col2", "input_col3" to "output_col3" >>> dataset = dataset.rename(input_columns=input_columns, output_columns=output_columns)