Skip to content

Commit

Permalink
Update pyarrow version, use pyarrow backend for pandas (#513)
Browse files Browse the repository at this point in the history
* Update pyarrow version, los prediction notebook

* Small fix to unique (cast as np array)

* Update dependencies in pyproject.toml

* Fix data type check in `filter_range` function

---------

Co-authored-by: Franklin <41602287+fcogidi@users.noreply.github.com>
  • Loading branch information
amrit110 and fcogidi authored Nov 27, 2023
1 parent b4a94c6 commit 6eb4e9c
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 184 deletions.
7 changes: 4 additions & 3 deletions cyclops/data/slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numpy as np
import pandas as pd
from dateutil.parser import parse
from pandas.api.types import is_datetime64_any_dtype, is_numeric_dtype


@dataclass
Expand Down Expand Up @@ -552,11 +553,11 @@ def filter_range(
example_values = pd.Series(
examples[column_name],
dtype="datetime64[ns]" if value_is_datetime else None,
).to_numpy()
)

if not ( # column does not contain number or datetime values
np.issubdtype(example_values.dtype, np.number)
or np.issubdtype(example_values.dtype, np.datetime64)
is_numeric_dtype(example_values.dtype)
or is_datetime64_any_dtype(example_values.dtype)
):
raise TypeError(
"Expected feature to be numeric or datetime, but got "
Expand Down
2 changes: 1 addition & 1 deletion cyclops/process/feature/handle_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_unique(
"""
if unique is None:
return values.unique() # type: ignore
return np.array(values.unique()) # type: ignore

return unique

Expand Down
Loading

0 comments on commit 6eb4e9c

Please sign in to comment.