Skip to content

Commit 064eabb

Browse files
committed
Refactor datetime column inference in parse_datetime_columns function
- Updated the condition for identifying string columns in the `parse_datetime_columns` function to use `pd.api.types.is_string_dtype` instead of checking for the "object" dtype. This change improves the accuracy of datetime column inference by leveraging pandas' type checking capabilities. These modifications enhance the robustness of the datetime parsing logic in the dataframe utilities.
1 parent fef49cc commit 064eabb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎robosystems_client/extensions/dataframe_utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def parse_datetime_columns(
105105
elif infer:
106106
# Infer datetime columns
107107
for col in df.columns:
108-
if df[col].dtype == "object":
108+
if pd.api.types.is_string_dtype(df[col]):
109109
# Check if column contains date-like strings
110110
sample = df[col].dropna().head(10)
111111
if len(sample) > 0:

0 commit comments

Comments
 (0)