backend.set_backend()

Set the global data frame backend for the tidyfinance API.

Usage

Source

backend.set_backend(backend)

Parameters

backend: str
Either ‘pandas’ (the default) or ‘polars’.

Raises

ValueError

If ‘backend’ is not a recognized value.

ImportError
If ‘backend’ is ‘pandas’ but the ‘pandas’ package is not installed.

Notes

The package computes in polars internally. The pandas backend wraps the public API at the package boundary: pandas inputs are converted to polars before each call, and polars outputs are converted to pandas on return. The polars backend is a pass-through with zero conversion overhead.

On conversion from pandas, known calendar-date columns (e.g. ‘date’, ‘datadate’, ‘trd_exctn_dt’) are cast from ‘polars.Datetime’ to ‘polars.Date’, since pandas has no plain date dtype. Any time-of-day component in a column with one of these names is therefore dropped on input. Timezone-aware datetime columns are never cast.