Skip to content

Commit fe341cf

Browse files
committed
Moved warning where str is checked
1 parent 32242c0 commit fe341cf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,6 +2587,14 @@ class Timestamp(_Timestamp):
25872587
tzinfo is None):
25882588
return ts_input
25892589
elif isinstance(ts_input, str):
2590+
if ts_input == "":
2591+
warnings.warn(
2592+
"Passing an empty string to Timestamp is deprecated and will raise "
2593+
"a ValueError in a future version.",
2594+
FutureWarning,
2595+
stacklevel = 2
2596+
)
2597+
25902598
# User passed a date string to parse.
25912599
# Check that the user didn't also pass a date attribute kwarg.
25922600
if any(arg is not None for arg in _date_attributes):
@@ -2645,14 +2653,6 @@ class Timestamp(_Timestamp):
26452653
"Passed data is timezone-aware, incompatible with 'tz=None'."
26462654
)
26472655
2648-
if ts_input == "":
2649-
warnings.warn(
2650-
"Passing an empty string to Timestamp is deprecated and will raise "
2651-
"a ValueError in a future version.",
2652-
FutureWarning,
2653-
stacklevel = 2
2654-
)
2655-
26562656
return create_timestamp_from_ts(ts.value, ts.dts, ts.tzinfo, ts.fold, ts.creso)
26572657
26582658
def _round(self, freq, mode, ambiguous="raise", nonexistent="raise"):

0 commit comments

Comments
 (0)