Links

Variable

class Variable

Variables represent the "columns" in tables (and uploads), and have certain metadata as well as detailed univariate summary statistics associated with them. Use this class to interface with variables and their metadata.

Constructors

table.variable(variable_name)
Construct a reference to a variable within a table based on its (case-insensitive) name.
upload.variable(variable_name)
Construct a reference to a variable within an upload based on its (case-insensitive) name.

Examples

Basics
table = redivis.organization("Demo").dataset("iris_species").table("iris")
variable = table.variable("sepalLengthCm")
variable.exists() # -> True
variable.get(wait_for_statistics=True)
print(variable.properties)
{
"kind": "variable",
... (see variable resource definition)
"statistics": {
"status": "completed",
"count": 150,
"numDistinct": 35,
"min": 4.3,
"max": 7.9,
"mean": 5.8433333333333355,
"approxMedian": 0.8280661279778625
}
}

Attributes

properties
A dict containing the API resource representation of the variable. This will only be populated after certain methods are called, particularly the get method, and will otherwise be None.
table
A reference to the Table instance that constructed this variable. Will be None if the variable belongs to an upload.
upload
A reference to the Upload instance that constructed this variable. Will be None if the variable belongs to a table.

Methods

variable.get([wait_for_statistics])
Gets the variable, after which the properties attribute will be populated according to the variable.get resource definition.
List all visible datasets owned by the user.
variable.update([*, label, description, ...])
Update a variable's metadata.