pyvista.DataSetAttributes.get#
- DataSetAttributes.get(key: str, value: Any | None = None) pyvista_ndarray | None[source]#
Return the value of the item with the specified key.
- Parameters:
- key
str Name of the array item you want to return the value from.
- value
Any,optional A value to return if the key does not exist. Default is
None.
- key
- Returns:
AnyArray if the
keyexists in the dataset, otherwisevalue.
Examples
Show that the default return value for a non-existent key is
None.>>> import pyvista as pv >>> mesh = pv.Cube() >>> mesh.point_data['my_data'] = range(mesh.n_points) >>> mesh.point_data.get('my-other-data')