evo.objects.typed.attributes.Attributes
A collection of Geoscience Object Attributes
__getitem__
__getitem__(index_or_name: int | str) -> Attribute | PendingAttribute
Get an attribute by index or name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_or_name
|
int | str
|
Either an integer index or the name/key of the attribute. |
required |
Returns:
| Type | Description |
|---|---|
Attribute | PendingAttribute
|
The attribute at the specified index or with the specified name/key. If a string is provided and no matching attribute exists, returns a PendingAttribute that can be used as a target for compute tasks. |
Raises:
| Type | Description |
|---|---|
IndexError
|
If the integer index is out of range. |
to_dataframe
to_dataframe(*keys: str, fb: IFeedback = NoFeedback) -> pd.DataFrame
Load a DataFrame containing the values from the specified attributes in the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
str
|
Optional list of attribute keys to filter the attributes by. If no keys are provided, all attributes will be loaded. |
()
|
fb
|
IFeedback
|
Optional feedback object to report download progress. |
NoFeedback
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing the values from the specified attributes. Column name(s) will be updated based on the attribute names. |
append_attribute
append_attribute(df: DataFrame, fb: IFeedback = NoFeedback)
Add a new attribute to the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing the values for the new attribute. The DataFrame should contain a single column. |
required |
fb
|
IFeedback
|
Optional feedback object to report upload progress. |
NoFeedback
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the DataFrame does not contain exactly one column. |
append_attributes
append_attributes(df: DataFrame, fb: IFeedback = NoFeedback)
Add new attributes to the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing the values for the new attributes. |
required |
fb
|
IFeedback
|
Optional feedback object to report upload progress. |
NoFeedback
|
set_attributes
set_attributes(df: DataFrame, fb: IFeedback = NoFeedback)
Set the attributes of the object to match the provided DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing the values for the new attributes. |
required |
fb
|
IFeedback
|
Optional feedback object to report upload progress. |
NoFeedback
|
validate_lengths
validate_lengths(expected_length: int) -> None
Validate that all attributes have the expected length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expected_length
|
int
|
The expected number of values for each attribute. |
required |
Raises:
| Type | Description |
|---|---|
ObjectValidationError
|
If any attribute has a different length. |