HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/hvplot/polars.py
"""Adds the `.hvplot` method to pl.DataFrame, pl.LazyFrame and pl.Series"""

from hvplot import post_patch, _module_extensions
from hvplot.plotting.core import hvPlotTabularPolars


def patch(name='hvplot', extension='bokeh', logo=False):
    try:
        import polars as pl
    except ImportError:
        raise ImportError(
            'Could not patch plotting API onto Polars. Polars could not be imported.'
        )
    if 'hvplot.polars' not in _module_extensions:
        pl.api.register_dataframe_namespace(name)(hvPlotTabularPolars)
        pl.api.register_series_namespace(name)(hvPlotTabularPolars)
        pl.api.register_lazyframe_namespace(name)(hvPlotTabularPolars)
        _module_extensions.add('hvplot.polars')

    post_patch(extension, logo)


patch()