You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/05/25 14:11:10 UTC

[GitHub] [superset] codemaster08240328 commented on a diff in pull request #20119: fix: Bad date type in email text report for table chart

codemaster08240328 commented on code in PR #20119:
URL: https://github.com/apache/superset/pull/20119#discussion_r881704447


##########
superset/utils/csv.py:
##########
@@ -97,11 +99,18 @@ def get_chart_dataframe(
         return None
 
     result = simplejson.loads(content.decode("utf-8"))
-
     # need to convert float value to string to show full long number
     pd.set_option("display.float_format", lambda x: str(x))
     df = pd.DataFrame.from_dict(result["result"][0]["data"])
 
+    # if any column type is equal to 2, need to convert data into datetime timestamp for that column.
+    if GenericDataType.TEMPORAL in result["result"][0]["coltypes"]:
+        for i in range(len(result["result"][0]["coltypes"])):
+            if result["result"][0]["coltypes"][i] == GenericDataType.TEMPORAL:
+                df[result["result"][0]["colnames"][i]] = df[
+                    result["result"][0]["colnames"][i]
+                ].astype("datetime64[ms]")

Review Comment:
   yeah, it should work.



-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org