Base data classes
CogniteResource
- class cognite.client.data_classes._base.CogniteResource(cognite_client: CogniteClient | None = None)
- dump(camel_case: bool = False) dict[str, Any]
Dump the instance into a json serializable Python data type.
- Parameters
camel_case (bool) – Use camelCase for attribute names. Defaults to False.
- Returns
A dictionary representation of the instance.
- Return type
dict[str, Any]
- to_pandas(expand: Sequence[str] = ('metadata',), ignore: list[str] | None = None, camel_case: bool = False) pandas.DataFrame
Convert the instance into a pandas DataFrame.
- Parameters
expand (Sequence[str]) – List of row keys to expand, only works if the value is a Dict. Will expand metadata by default.
ignore (list[str] | None) – List of row keys to not include when converting to a data frame.
camel_case (bool) – Convert column names to camel case (e.g. externalId instead of external_id)
- Returns
The dataframe.
- Return type
pandas.DataFrame
CogniteResourceList
- class cognite.client.data_classes._base.CogniteResourceList(resources: Collection[Any], cognite_client: CogniteClient | None = None)
- dump(camel_case: bool = False) list[dict[str, Any]]
Dump the instance into a json serializable Python data type.
- Parameters
camel_case (bool) – Use camelCase for attribute names. Defaults to False.
- Returns
A list of dicts representing the instance.
- Return type
list[dict[str, Any]]
- extend(other: Collection[Any]) None
S.extend(iterable) – extend sequence by appending elements from the iterable
- get(id: int | None = None, external_id: str | None = None) T_CogniteResource | None
Get an item from this list by id or external_id.
- Parameters
id (int | None) – The id of the item to get.
external_id (str | None) – The external_id of the item to get.
- Returns
The requested item
- Return type
T_CogniteResource | None
- pop([index]) item -- remove and return item at index (default last).
Raise IndexError if list is empty or index is out of range.
- to_pandas(camel_case: bool = False, expand_metadata: bool = False, metadata_prefix: str = 'metadata.') pandas.DataFrame
Convert the instance into a pandas DataFrame. Note that if the metadata column is expanded and there are keys in the metadata that already exist in the DataFrame, then an error will be raised by pd.join.
- Parameters
camel_case (bool) – Convert column names to camel case (e.g. externalId instead of external_id)
expand_metadata (bool) – Expand the metadata column into separate columns.
metadata_prefix (str) – Prefix to use for metadata columns.
- Returns
The Cognite resource as a dataframe.
- Return type
pandas.DataFrame
CogniteResponse
- class cognite.client.data_classes._base.CogniteResponse
- dump(camel_case: bool = False) dict[str, Any]
Dump the instance into a json serializable Python data type.
- Parameters
camel_case (bool) – Use camelCase for attribute names. Defaults to False.
- Returns
A dictionary representation of the instance.
- Return type
dict[str, Any]
CogniteFilter
- class cognite.client.data_classes._base.CogniteFilter
- dump(camel_case: bool = False) dict[str, Any]
Dump the instance into a json serializable Python data type.
- Parameters
camel_case (bool) – Use camelCase for attribute names. Defaults to False.
- Returns
A dictionary representation of the instance.
- Return type
dict[str, Any]
CogniteUpdate
- class cognite.client.data_classes._base.CogniteUpdate(id: int | None = None, external_id: str | None = None)
- dump(camel_case: bool = True) dict[str, Any]
Dump the instance into a json serializable Python data type.
- Parameters
camel_case (bool) – No description.
- Returns
A dictionary representation of the instance.
- Return type
dict[str, Any]