vortexasdk.endpoints.attributes

Try me out in your browser:

Binder

Attributes

Attributes(self)

Attributes endpoint.

An Attribute is a reference value that corresponds to an ID associated with other entities.

For example, a vessel object from the Vessel reference endpoint may have the following keys:

{
    "ice_class": "b09ed4e2bd6904dd",
    "propulsion": "3ace0e050724707b"
}

These IDs represent attributes which can be found via the Attributes reference endpoint.

When the attributes endpoint is searched with those ids as parameters:

    >>> from vortexasdk import Attributes
    >>> df = Attributes().search(ids=["b09ed4e2bd6904dd", "3ace0e050724707b"]).to_df()

Returns

id type label
0 b09ed4e2bd6904dd ice_class UNKNOWN
1 3ace0e050724707b propulsion DFDE

load_all

Attributes.load_all(self) -> vortexasdk.endpoints.attributes_result.AttributeResult

Load all attributes.

search

Attributes.search(self, type: str = None, term: Union[str, List[str]] = None, ids: Union[str, List[str]] = None) -> vortexasdk.endpoints.attributes_result.AttributeResult

Find all attributes matching given type.

Arguments

  • type: The type of attribute we're filtering on. Type can be: ice_class, propulsion, scrubber

Returns

List of attributes matching type

Examples

Find all attributes with a type of ice_class.

>>> from vortexasdk import Attributes
>>> df = Attributes().search(type="scrubber").to_df()

returns

id name type
0 14c7b073809eb565 Open Loop scrubber
1 478fca39000c49d6 Unknown scrubber

vortexasdk.endpoints.attributes_result

AttributeResult

AttributeResult(__pydantic_self__, **data: Any) -> None

Container class that holds the result obtained from calling the Attributes endpoint.

to_list

AttributeResult.to_list(self) -> List[vortexasdk.api.attribute.Attribute]

Represent attributes as a list.

to_df

AttributeResult.to_df(self, columns=['id', 'name', 'type']) -> pandas.core.frame.DataFrame

Represent attributes as a pd.DataFrame.

Arguments

  • columns: The attributes features we want in the dataframe. Enter columns='all' to include all features. Defaults to columns = ['id', 'name', 'type'].

Returns

pd.DataFrame of attributes.