Variable.update
Variable.update(*, label=None, description=None, value_labels=None) → self
Update metadata attributes on a variable. Only updates an attribute if the value is not none; to unset an attribute, set it to an empty string.
Parameters:
label
: str, default None
If specified, will set the variable's label. Must be less than or equal to 256 characters. Pass an empty string to unset a variable's label.
description
: str, default None
If specified, will set the variable's description. Must be less than or equal to 5000 characters. Pass an empty string to unset a variable's description.
value_labels
: list<{ "value": str, "label": str }> | None, default None
If specified, will set the value labels on a variable. Passed as a list of dicts with keys "value" and "label". Pass an empty list to unset the variable's value labels.
Returns:
self (a Variable)
Examples:
table = redivis.organization("Demo").dataset("iris_species").table("iris")
variable = table.variable("sepalLengthCm")
variable.update(label="Sepal length in centimeters",
description="A detailed description of how this variable was collected"
)
# Update value labels on another variable (this particular example is a bit contrived)
table.variable("Species").update([
{"value": "Iris-setosa", "label": "A detailed description about this value"},
{"value": "Iris-versicolor", "label": "A detailed description about this other value"},
])
Last updated
Was this helpful?