DataFrame.get

DataFrame.get(key: Any, default: Any | None = None) Series | DataFrame[source]

Get item from object for given key (ex: DataFrame column). Returns default value if not found.

Parameters

key: object default: default value if not found

Returns

value: same type as items contained in object

See Also

:pandas_api_docs:`pandas.DataFrame.get`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights')
>>> df.get('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