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()

Load all attributes.

search

Attributes.search(
  type: typing.Optional[str] = None,
  term: typing.Union[str, typing.List[str], NoneType] = None,
  ids: typing.Union[str, typing.List[str], NoneType] = None)

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(*, records: typing.List,
                reference: typing.Dict[str, typing.Any])

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

model_config

to_list

AttributeResult.to_list()

Represent attributes as a list.

to_df

AttributeResult.to_df(
    columns:
    typing.Union[typing_extensions.Literal['all'], typing.List[str], NoneType] = ['id', 'name', 'type']
)

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.