Series.rename

Series.rename(new_name: str) Series[source]

Rename name of series. Only column rename is supported. This does not change the underlying index, but adds a symbolic link from the new name (column) to the OpenSearch field name.

For instance, if a field was called ‘total_quantity’ it could be renamed ‘Total Quantity’.

Parameters

new_name: str

Returns

opensearch_py_ml.Series

opensearch_py_ml.Series with new name.

See Also

:pandas_api_docs:`pandas.Series.rename`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights')
>>> df.Carrier
0         Kibana Airlines
1        Logstash Airways
2        Logstash Airways
3         Kibana Airlines
4         Kibana Airlines
               ...
13054    Logstash Airways
13055    Logstash Airways
13056    Logstash Airways
13057            JetBeats
13058            JetBeats
Name: Carrier, Length: 13059, dtype: object
>>> df.Carrier.rename('Airline')
0         Kibana Airlines
1        Logstash Airways
2        Logstash Airways
3         Kibana Airlines
4         Kibana Airlines
               ...
13054    Logstash Airways
13055    Logstash Airways
13056    Logstash Airways
13057            JetBeats
13058            JetBeats
Name: Airline, Length: 13059, dtype: object