Reading tabular data

Read table data into python

import redivis

# Specify the table's container, either a dataset or project
dataset = redivis.organization("Demo").dataset("iris_species")

table = dataset.table("Iris")
table.to_pandas_dataframe()
# 	Id	SepalLengthCm	SepalWidthCm	PetalLengthCm	PetalWidthCm	Species
# 0	33	5.2	        4.1	        1.5	        0.1	        Iris-setosa
# ...

# Other methods to read data:
# table.to_arrow_batch_iterator()
# table.to_arrow_dataset()
# table.to_arrow_table()
# table.to_geopandas_dataframe()
# table.to_dask_dataframe()
# table.to_polars_lazyframe()

Read table metadata

import redivis

table = redivis.organization("Demo").dataset("iris_species").table("iris")

variable = table.variable("sepalLengthCm")
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
	}
}

Load a table within a Redivis notebook

# In a notebook, all tables are scoped to the current project.
# Additionally, the notebook's source table can simply be referenced as _source_
table = redivis.table("_source_")

table.to_pandas_dataframe()

Last updated