aminghadersohi commented on code in PR #44695: URL: https://github.com/apache/superset/pull/44695#discussion_r4120025944
########## superset/db_engine_specs/gsheets.py: ########## @@ -64,6 +66,43 @@ ma_plugin = MarshmallowPlugin() +def _to_python_value(value: Any) -> Any: + """ + Convert numpy and pandas scalars into their Python equivalents. + """ + if isinstance(value, np.datetime64): + # ``.item()`` returns an int for nanosecond precision; go through pandas. + value = pd.Timestamp(value) + elif isinstance(value, np.generic): + # e.g. ``np.timedelta64.item()`` returns a ``timedelta``. + value = value.item() Review Comment: Fixed in 6211f59beff6d8d7df526226a7015a38912eee29 by normalizing np.timedelta64 through pd.Timedelta, with regression tests for nanosecond durations and NaT (49 unit tests and pre-commit passed). -- 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]
