Skip to content

Commit

Permalink
improved exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
deadsoul44 committed Jul 17, 2024
1 parent 88b3f9b commit bc099dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python-package/python/perpetual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def convert_input_frame(

try:
X_ = X.to_numpy(allow_copy=False)
except:
except RuntimeError:
X_ = X.to_numpy(allow_copy=True)

features_ = X.columns
Expand Down Expand Up @@ -252,7 +252,7 @@ def transform_input_frame(X, cat_mapping) -> tuple[list[str], np.ndarray, int, i
elif type_df(X) == "polars_df":
try:
X_ = X.to_numpy(allow_copy=False)
except:
except RuntimeError:
X_ = X.to_numpy(allow_copy=True)
features_ = X.columns
else:
Expand Down Expand Up @@ -1037,7 +1037,7 @@ def _id(i: int) -> str:
return pl.from_records(vals).sort(
["Tree", "Node"], descending=[False, False]
)
except:
except ImportError:
import pandas as pd

return pd.DataFrame.from_records(vals).sort_values(
Expand Down

0 comments on commit bc099dd

Please sign in to comment.