Books#
bookshelf.Book #
Book(client: BookshelfClient, cache: ContentCache, metadata: models.BookListItem, entries: list[models.BookEntryItem])
Bases: _BookBase
A resolved published Book indexed by Entry name.
bookshelf.AsyncBook #
AsyncBook(client: BookshelfClient, cache: ContentCache, metadata: models.BookListItem, entries: list[models.BookEntryItem])
Bases: _BookBase
An asynchronously resolved published Book indexed by Entry name.
bookshelf.BookEntry #
BookEntry(client: BookshelfClient, cache: ContentCache, book_id: str | UUID, entry: models.BookEntryItem)
Bases: Resource
A resource handle with its book scoped exploration capabilities.
tracking_id instance-attribute #
The platform's id for this resource.
content_hash #
Return the declared sha256: digest, from memory or disk before the platform.
as_df #
Return the whole resource as pandas, using wide indexed form for timeseries.
The year window and column=value filters apply locally, after the download.
as_long_df #
as_long_df(*, year_min: int | None = None, year_max: int | None = None, legacy_columns: bool = False, **filters: str) -> pd.DataFrame
Return tidy pandas timeseries data.
legacy_columns reproduces the 0.4 long format instead: a values column, a year column of YYYY-01-01 00:00:00 strings, and rows sorted by the dimensions and then the year.
as_polars #
as_polars(*, year_min: int | None = None, year_max: int | None = None, **filters: str) -> pl.DataFrame
Return the resource as a Polars DataFrame.
as_arrow #
Return the resource as a PyArrow table.
as_scmrun #
Return timeseries data as an scmdata ScmRun.
scmdata rejects rows with duplicate metadata.
fetch #
Return verified bytes, using memory proportional to the resource size.
Use as_path() to stream large resources without loading them into memory.
query #
query(*, select: str | None = None, order: str | None = None, year_min: int | None = None, year_max: int | None = None, drop_constant: bool = False, top_n: int | None = None, limit: int | None = None, offset: int | None = None, **filters: str) -> pd.DataFrame
Return book scoped data filtered and trimmed on the server.
Timeseries go through the book timeseries endpoint, which truncates at its row limit.
facets #
Return book scoped facet values.
preview #
Return a book scoped tabular preview.
schema #
Return book scoped timeseries schema metadata.
bookshelf.AsyncBookEntry #
AsyncBookEntry(client: BookshelfClient, cache: ContentCache, book_id: str | UUID, entry: models.BookEntryItem)
Bases: AsyncResource
An async resource handle with book scoped exploration capabilities.
tracking_id instance-attribute #
The platform's id for this resource.
content_hash async #
Return the declared sha256: digest, from memory or disk before the platform.
as_df async #
Return the whole resource as pandas, using wide indexed form for timeseries.
The year window and column=value filters apply locally, after the download.
as_long_df async #
as_long_df(*, year_min: int | None = None, year_max: int | None = None, legacy_columns: bool = False, **filters: str) -> pd.DataFrame
Return tidy pandas timeseries data.
legacy_columns reproduces the 0.4 long format instead: a values column, a year column of YYYY-01-01 00:00:00 strings, and rows sorted by the dimensions and then the year.
as_polars async #
as_polars(*, year_min: int | None = None, year_max: int | None = None, **filters: str) -> pl.DataFrame
Return the resource as a Polars DataFrame.
as_arrow async #
Return the resource as a PyArrow table.
as_scmrun async #
Return timeseries data as an scmdata ScmRun.
scmdata rejects rows with duplicate metadata.
fetch async #
Return verified bytes, using memory proportional to the resource size.
Use as_path() to stream large resources without loading them into memory.
query async #
query(*, select: str | None = None, order: str | None = None, year_min: int | None = None, year_max: int | None = None, drop_constant: bool = False, top_n: int | None = None, limit: int | None = None, offset: int | None = None, **filters: str) -> pd.DataFrame
Return book scoped data filtered and trimmed on the server.
Timeseries go through the book timeseries endpoint, which truncates at its row limit.
as_resource #
Drop book context and return the lean async resource handle.
facets async #
Return book scoped facet values.
preview async #
Return a book scoped tabular preview.
schema async #
Return book scoped timeseries schema metadata.