Skip to content

Commit

Permalink
style: == to is for type comparison (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
eroell authored Jul 15, 2024
1 parent 6db089d commit 2ac2a54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ehrapy/anndata/_feature_specifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _detect_feature_type(col: pd.Series) -> tuple[Literal["date", "categorical",
if majority_type == pd.Timestamp:
return DATE_TAG, False # type: ignore

if majority_type == str:
if majority_type is str:
try:
col.apply(isoparse)
return DATE_TAG, False # type: ignore
Expand All @@ -55,7 +55,7 @@ def _detect_feature_type(col: pd.Series) -> tuple[Literal["date", "categorical",

# Guess categorical if the feature is an integer and the values are 0/1 to n-1/n with no gaps
if (
(majority_type == int or (np.all(i.is_integer() for i in col)))
(majority_type is int or (np.all(i.is_integer() for i in col)))
and (n_elements != col.nunique())
and (
(col.min() == 0 and np.all(np.sort(col.unique()) == np.arange(col.nunique())))
Expand Down

0 comments on commit 2ac2a54

Please sign in to comment.