Skip to content

Commit

Permalink
updated str_is_numeric(), allows floats
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiyarr committed Feb 18, 2025
1 parent 6bcd303 commit bd25234
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pandas/core/strings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Literal,
)

from pandas._libs import lib
#from pandas._libs import lib

if TYPE_CHECKING:
from collections.abc import (
Expand Down Expand Up @@ -93,7 +93,7 @@ def _str_match(
pat: str,
case: bool = True,
flags: int = 0,
na: Scalar | lib.NoDefault = lib.no_default,
#na: Scalar | lib.NoDefault = lib.no_default,
):
pass

Expand All @@ -103,7 +103,7 @@ def _str_fullmatch(
pat: str | re.Pattern,
case: bool = True,
flags: int = 0,
na: Scalar | lib.NoDefault = lib.no_default,
#na: Scalar | lib.NoDefault = lib.no_default,
):
pass

Expand Down Expand Up @@ -197,7 +197,11 @@ def _str_islower(self):

@abc.abstractmethod
def _str_isnumeric(self):
pass
try:
float(self)
return True
except ValueError:
return False

@abc.abstractmethod
def _str_isspace(self):
Expand Down

0 comments on commit bd25234

Please sign in to comment.