Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyopenms_viz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import types
from pathlib import Path
from ._core import plot_chromatogram, plot_spectrum, plot_mobilogram, plot_peakmap
from . import _pandas_accessor # Import for side effects: registers Pandas 'ms_plot' namespace. noqa: F401
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

__version__ = "1.0.1"

Expand Down
15 changes: 15 additions & 0 deletions pyopenms_viz/_pandas_accessor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pandas as pd

@pd.api.extensions.register_dataframe_accessor("ms_plot")
class PandasPlotAccessor:
"""
Registers a custom '.ms_plot' namespace for Pandas DataFrames.
This provides a unified API syntax alongside the Polars integration.
"""
def __init__(self, pandas_obj):
self._df = pandas_obj

def __call__(self, *args, **kwargs):
# Delegate directly to the native pandas plot method.
# This ensures all existing ms_* backends and entry points work perfectly.
return self._df.plot(*args, **kwargs)
Loading
Loading