Skip to content

ENH: updated str_is_numeric(), allows floats #60953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading