luizotavio32 commented on code in PR #34763: URL: https://github.com/apache/superset/pull/34763#discussion_r2323933878
########## superset/commands/database/uploaders/csv_reader.py: ########## @@ -123,6 +123,96 @@ def _select_optimal_engine() -> str: ) return "c" + @staticmethod + def _find_invalid_values_numeric(df: pd.DataFrame, column: str) -> pd.Series: + """Find invalid values for numeric type conversion.""" + converted = pd.to_numeric(df[column], errors="coerce") + return converted.isna() & df[column].notna() + + @staticmethod + def _find_invalid_values_non_numeric( + df: pd.DataFrame, column: str, dtype: str + ) -> pd.Series: + """Find invalid values for non-numeric type conversion.""" + invalid_mask = pd.Series([False] * len(df), index=df.index) + for idx, value in df[column].items(): + if pd.notna(value): + try: + pd.Series([value]).astype(dtype) + except (ValueError, TypeError): + invalid_mask[idx] = True + break Review Comment: Is that what you're thinking ? <img width="471" height="124" alt="image" src="https://github.com/user-attachments/assets/b66900f3-81c7-43d8-89f3-af24898f1dfd" /> -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org