Fluent Bokeh charting for Polars and Pandas DataFrames
Project description
Xpectral Chart
Fluent Bokeh charting that extends Polars and Pandas DataFrames via the
accessor pattern: df.bokeh.line(...), df.bokeh.scatter(...), and more.
Part of the Xpectral project, alongside xpectral-quant
(financial metrics and market data). Both install into the shared xpectral
namespace and can be used together.
Usage
import xpectral.charts # registers the df.bokeh accessor
from xpectral.charts import PandasDataFrame
from xpectral.charts import PolarsDataFrame
df: PolarsDataFrame = pl.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
fig = df.bokeh(title="Example", width=600, height=400)
fig.line(x="x", y="y")
pd_df: PandasDataFrame = pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
pd_fig = pd_df.bokeh(title="Example", width=600, height=400)
pd_fig.line(x="x", y="y")
Importing xpectral.charts is what registers the accessor on Polars and Pandas
DataFrames. Annotate sample DataFrames with PolarsDataFrame or
PandasDataFrame when you want the editor (pyright) to resolve the
df.bokeh(...) parameters and chained accessor methods — annotation is
necessary for type hinting, as accessors are not discovered dynamically.
Custom chart methods
Use BokehAccessor.register to add your own methods to the accessor. The
decorated function receives self — the accessor instance — giving access to
self._df, self.source, self.plot, and all built-in glyph methods.
from xpectral.charts import BokehAccessor
@BokehAccessor.register
def price_band(self, mid, upper, lower, **kwargs):
self.line(y=mid, **kwargs)
self.varea(y1=lower, y2=upper, fill_alpha=0.2, **kwargs)
fig = df.bokeh(title="Bands", width=800, height=400)
fig.price_band(mid="close", upper="upper", lower="lower")
The method is available on both Polars and Pandas accessors immediately after registration.
See xpectral/charts/README.md for the module-level
documentation (glyph methods, stacks, auto-color, themes, datetime axes).
Install
pip install xpectral-chart
uv add xpectral-chart
For development:
uv sync
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xpectral_chart-1.0.0.tar.gz.
File metadata
- Download URL: xpectral_chart-1.0.0.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27d3cdb855352ebc65b69e75d333792b90662f99a5a3f44056317cf7961d2238
|
|
| MD5 |
224c9e2dc71010ec3025a2ad19e5e50e
|
|
| BLAKE2b-256 |
bc8e9b1349e9b5d083b76ea1b3904d6e40a5fa519162fb67cf4f1e63d2ec7ac3
|
Provenance
The following attestation bundles were made for xpectral_chart-1.0.0.tar.gz:
Publisher:
publish.yml on bayquant/xpectral-chart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xpectral_chart-1.0.0.tar.gz -
Subject digest:
27d3cdb855352ebc65b69e75d333792b90662f99a5a3f44056317cf7961d2238 - Sigstore transparency entry: 2063238156
- Sigstore integration time:
-
Permalink:
bayquant/xpectral-chart@bd6e07a176d044f035e6713b8549cfe29f0e5410 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bayquant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bd6e07a176d044f035e6713b8549cfe29f0e5410 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file xpectral_chart-1.0.0-py3-none-any.whl.
File metadata
- Download URL: xpectral_chart-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87b46dc269a3c3c1377768767207ea8cdfc7932d4582e477103fc4a2509c171a
|
|
| MD5 |
39759d8871cf2f62ba778541083d213a
|
|
| BLAKE2b-256 |
9f60beef8e458a5ab37a99e8aeb2a7b17af2e50c81663753862a114345ff8b96
|
Provenance
The following attestation bundles were made for xpectral_chart-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on bayquant/xpectral-chart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xpectral_chart-1.0.0-py3-none-any.whl -
Subject digest:
87b46dc269a3c3c1377768767207ea8cdfc7932d4582e477103fc4a2509c171a - Sigstore transparency entry: 2063238189
- Sigstore integration time:
-
Permalink:
bayquant/xpectral-chart@bd6e07a176d044f035e6713b8549cfe29f0e5410 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bayquant
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bd6e07a176d044f035e6713b8549cfe29f0e5410 -
Trigger Event:
workflow_dispatch
-
Statement type: