Skip to content

Commit

Permalink
Add polars datastructures to Vector and Matrix type definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
kklein committed Sep 5, 2024
1 parent 0462b5f commit 95b5058
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metalearners/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np
import pandas as pd
import polars as pl
import scipy.sparse as sps

PredictMethod = Literal["predict", "predict_proba"]
Expand All @@ -21,8 +22,8 @@
Features = Collection[str] | Collection[int] | None

# ruff is not happy about the usage of Union.
Vector = Union[pd.Series, np.ndarray] # noqa
Matrix = Union[pd.DataFrame, np.ndarray, sps.csr_matrix] # noqa
Vector = Union[pd.Series, np.ndarray, pl.Series] # noqa
Matrix = Union[pd.DataFrame, np.ndarray, sps.csr_matrix, pl.DataFrame] # noqa


class _ScikitModel(Protocol):
Expand Down

0 comments on commit 95b5058

Please sign in to comment.