teehr.LocationTable#

class teehr.LocationTable(ev)[source]#

Bases: BaseTable

Access methods to locations table.

Methods

distinct_values

Return distinct values for a column.

field_enum

Get the location fields enum.

fields

Return table columns as a list.

filter

Apply a filter.

load_spatial

Import geometry data.

order_by

Apply an order_by.

query

Run a query against the table with filters and order_by.

to_geopandas

Return GeoPandas DataFrame.

to_pandas

Return Pandas DataFrame for Location Table.

to_sdf

Return PySpark DataFrame.

validate

Validate the dataset table against the schema.

field_enum() LocationFields[source]#

Get the location fields enum.

load_spatial(in_path: Path | str, field_mapping: dict | None = None, pattern: str = '**/*.parquet', **kwargs)[source]#

Import geometry data.

Parameters:
  • in_path (Union[Path, str]) – The input file or directory path. Any file format that can be read by GeoPandas.

  • field_mapping (dict, optional) – A dictionary mapping input fields to output fields. Format: {input_field: output_field}

  • pattern (str, optional (default: "**/*.parquet")) – The pattern to match files. Only used when in_path is a directory.

  • **kwargs – Additional keyword arguments are passed to GeoPandas read_file().

  • File is first read by GeoPandas, field names renamed and

  • then validated and inserted into the dataset.

Notes

The TEEHR Location Crosswalk table schema includes fields:

  • id

  • name

  • geometry

to_geopandas()[source]#

Return GeoPandas DataFrame.

to_pandas()[source]#

Return Pandas DataFrame for Location Table.