Skip to content

Commit

Permalink
Merge branch 'feature/polars' into polars_feature_rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorfturner authored Apr 29, 2024
2 parents 18772d2 + c4b9c59 commit 95679a5
Show file tree
Hide file tree
Showing 13 changed files with 472 additions and 483 deletions.
8 changes: 4 additions & 4 deletions dataprofiler/profilers/base_column_profilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any, Callable, Generic, TypeVar

import numpy as np
import pandas as pd
import polars as pl

from . import profiler_utils
from .profiler_options import BaseInspectorOptions, BaseOption
Expand Down Expand Up @@ -97,7 +97,7 @@ def _filter_properties_w_options(
def _perform_property_calcs(
self,
calculations: dict,
df_series: pd.DataFrame,
df_series: pl.Series,
prev_dependent_properties: dict,
subset_properties: dict,
) -> None:
Expand Down Expand Up @@ -217,12 +217,12 @@ def __getitem__(self, item: str) -> Any:
return getattr(self, item)

@abc.abstractmethod
def _update_helper(self, df_series_clean: pd.DataFrame, profile: dict) -> None:
def _update_helper(self, df_series_clean: pl.Series, profile: dict) -> None:
"""Help update the profile."""
raise NotImplementedError()

@abc.abstractmethod
def update(self, df_series: pd.DataFrame) -> BaseColumnProfiler:
def update(self, df_series: pl.Series) -> BaseColumnProfiler:
"""
Update the profile.
Expand Down
6 changes: 5 additions & 1 deletion dataprofiler/profilers/categorical_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from typing import cast

import datasketches
import pandas as pd
import polars as pl
from pandas import DataFrame, Series
from polars import DataFrame, Series

from .. import dp_logging
from . import profiler_utils
Expand Down Expand Up @@ -681,6 +682,9 @@ def update(self, df_series: pl.Series | Series) -> CategoricalColumn:
:return: updated CategoricalColumn
:rtype: CategoricalColumn
"""
# TODO remove onces profiler builder is updated
if isinstance(df_series, pd.Series):
df_series = pl.from_pandas(df_series) # type: ignore
# If condition for limiting profile calculations
if len(df_series) == 0 or self._stop_condition_is_met:
return self
Expand Down
Loading

0 comments on commit 95679a5

Please sign in to comment.