ts_shape.loader.timeseries.azure_blob_energy_loader
| Name | Description |
|---|---|
AzureBlobEnergyLoader | Load CSV energy timeseries and series metadata from Azure Blob Storage. |
AzureBlobEnergyLoader
AzureBlobEnergyLoader(
container_name: str | None = None,
*,
connection_string: str | None = None,
account_url: str | None = None,
credential: Any | None = None,
sas_url: str | None = None,
prefix: str = "",
max_workers: int = 8,
thousands: str | None = None,
decimal: str = "."
) -> None
Load CSV energy timeseries and series metadata from Azure Blob Storage.
Bucket structure::
<system>-<region>-<location>-energy-data (container)
.meta/
series.csv ← series metadata
csv/
YYYY/MM/DD/
<series_id>.csv ← interval readings: time, value columns
Authentication supports three methods identical to AzureBlobParquetLoader:
-
SAS URL::
loader = AzureBlobEnergyLoader( sas_url="https://account.blob.core.windows.net/container?sv=...&sig=..." )
-
Connection string::
loader = AzureBlobEnergyLoader( connection_string="DefaultEndpointsProtocol=https;AccountName=...;", container_name="prod-west-plantA-energy-data", )
-
AAD credential::
loader = AzureBlobEnergyLoader( account_url="https://account.blob.core.windows.net", container_name="prod-west-plantA-energy-data", credential=DefaultAzureCredential(), )
All load methods return a DataFrame with the standard ts-shape schema::
systime | uuid | value_double | is_delta
where uuid is the series_id (stem of the CSV filename).
| Name | Description |
|---|---|
from_account_name | Construct a loader using AAD credentials with an account name. |
load_series_metadata | Download .meta/series.csv and return as a DataFrame. |
load_by_time_range | Load all CSV files in csv/YYYY/MM/DD/ for each (UTC) date in [start, end]. |
load_by_series_ids | Load specific series by ID. |
stream_by_time_range | Stream CSV files one at a time as (series_id, DataFrame) tuples. |
list_series | List all series IDs present in the blob store by scanning csv/. |
connection_string: Azure Storage connection string.
account_url: Full account URL for AAD auth.
credential: Azure credential object for AAD auth.
sas_url: Full Blob SAS URL including container and SAS token.
prefix: Optional blob prefix to narrow all listings.
max_workers: Max concurrent downloads.
thousands: Thousands separator for pd.read_csv (default None — standard floats).
decimal: Decimal separator for pd.read_csv (default ".").
from_account_name
from_account_name(
account_name: str,
container_name: str,
*,
credential: Any | None = None,
endpoint_suffix: str = "blob.core.windows.net",
prefix: str = "",
max_workers: int = 8,
thousands: str | None = None,
decimal: str = "."
) -> Self
Construct a loader using AAD credentials with an account name.
| Name | Type | Description | Default |
|---|---|---|---|
account_name | str | Storage account name. | required |
container_name | str | Target container. | required |
credential | Any | None | Azure credential (required). | None |
endpoint_suffix | str | DNS suffix for sovereign clouds. | 'blob.core.windows.net' |
prefix | str | Optional listing prefix. | '' |
max_workers | int | Concurrency for downloads. | 8 |
thousands | str | None | Thousands separator passed to pd.read_csv. | None |
decimal | str | Decimal separator passed to pd.read_csv. | '.' |
load_series_metadata
load_series_metadata() -> pd.DataFrame
Download .meta/series.csv and return as a DataFrame.
id, label_lvl1, label_lvl2, label_lvl3, label_lvl4,
description, unit, hierarchy_lvl1 … hierarchy_lvl6
Returns an empty DataFrame with the expected columns, and emits a
:class:~ts_shape.errors.LoaderConfigWarning, when the blob does not
exist.
| Type | Description |
|---|---|
LoaderError | When the blob exists but cannot be downloaded or parsed. |
load_by_time_range
load_by_time_range(
start: str | pd.Timestamp,
end: str | pd.Timestamp,
series_ids: list[str] | None = None,
*,
errors: ErrorsMode = "warn"
) -> pd.DataFrame
Load all CSV files in csv/YYYY/MM/DD/ for each (UTC) date in [start, end].
Day folders are read in full; rows whose systime falls outside
[start, end] are then dropped. A date-only end
("2026-01-13") keeps that whole day; naive bounds are UTC.
| Name | Type | Description | Default |
|---|---|---|---|
start | str | Timestamp | Start date/datetime (inclusive). | required |
end | str | Timestamp | End date/datetime (inclusive). | required |
series_ids | list[str] | None | Optional list of series IDs to load. Loads all if None. | None |
errors | ErrorsMode | "warn" (default) skips a CSV that cannot be downloaded or parsed and emits one :class:~ts_shape.errors.DataQualityWarning naming every skipped blob; "raise" raises :class:~ts_shape.errors.LoaderError instead. | 'warn' |
| Type | Description |
|---|---|
DataFrame | Standard schema DataFrame: systime |
load_by_series_ids
load_by_series_ids(
series_ids: list[str],
start: str | pd.Timestamp | None = None,
end: str | pd.Timestamp | None = None,
*,
errors: ErrorsMode = "warn"
) -> pd.DataFrame
Load specific series by ID.
With start/end: lists the day folders in the range, keeps the
requested series and drops rows outside [start, end] (as
:meth:load_by_time_range). Without dates: lists all blobs under
csv/ and filters by stem. With only one bound the range is open on
the other side: every day folder on or after start (or on or
before end) is read in full.
| Name | Type | Description | Default |
|---|---|---|---|
series_ids | list[str] | Series IDs to load. | required |
start | str | Timestamp | None | Optional start date filter (inclusive). | None |
end | str | Timestamp | None | Optional end date filter (inclusive). | None |
errors | ErrorsMode | "warn" (default) skips a CSV that cannot be downloaded or parsed and emits one :class:~ts_shape.errors.DataQualityWarning naming every skipped blob; "raise" raises :class:~ts_shape.errors.LoaderError instead. | 'warn' |
| Type | Description |
|---|---|
DataFrame | Standard schema DataFrame: systime |
stream_by_time_range
stream_by_time_range(
start: str | pd.Timestamp,
end: str | pd.Timestamp,
series_ids: list[str] | None = None,
*,
errors: ErrorsMode = "warn"
) -> Iterator[tuple[str, pd.DataFrame]]
Stream CSV files one at a time as (series_id, DataFrame) tuples.
Memory-efficient alternative to load_by_time_range for large date
ranges; rows outside [start, end] are dropped the same way.
| Name | Type | Description | Default |
|---|---|---|---|
start | str | Timestamp | Start date/datetime (inclusive). | required |
end | str | Timestamp | End date/datetime (inclusive). | required |
series_ids | list[str] | None | Optional series filter. | None |
errors | ErrorsMode | "warn" (default) skips a CSV that cannot be downloaded or parsed and emits one (after the last file) :class:~ts_shape.errors.DataQualityWarning naming every skipped blob; "raise" raises :class:~ts_shape.errors.LoaderError instead. | 'warn' |
| Type | Description |
|---|---|
tuple[str, DataFrame] | (series_id, DataFrame) where DataFrame has the standard schema. |
list_series
list_series() -> list[str]
List all series IDs present in the blob store by scanning csv/.
| Type | Description |
|---|---|
list[str] | Sorted list of unique series ID strings. |