Cloud-Architect-Emma commented on code in PR #40190:
URL: https://github.com/apache/superset/pull/40190#discussion_r3252848286
##########
superset/common/utils/dataframe_utils.py:
##########
@@ -57,7 +57,7 @@ def df_metrics_to_num(df: pd.DataFrame, query_object:
QueryObject) -> None:
if dtype.type == np.object_ and col in query_object.metric_names:
# soft-convert a metric column to numeric
# will stay as strings if conversion fails
- df[col] = df[col].infer_objects()
+ df[col] = pd.to_numeric(df[col], errors="ignore")
Review Comment:
Good catch! Updated to use errors="coerce" so valid numeric strings
are converted and invalid values become NaN rather than leaving the
entire column as object type.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]