rusackas commented on code in PR #30961:
URL: https://github.com/apache/superset/pull/30961#discussion_r1857351013


##########
superset/charts/post_processing.py:
##########
@@ -339,29 +344,32 @@ def apply_post_process(
         query["indexnames"] = list(processed_df.index)
         query["coltypes"] = extract_dataframe_dtypes(processed_df, datasource)
         query["rowcount"] = len(processed_df.index)
-
-        # Flatten hierarchical columns/index since they are represented as
-        # `Tuple[str]`. Otherwise encoding to JSON later will fail because
-        # maps cannot have tuples as their keys in JSON.
-        processed_df.columns = [
-            " ".join(str(name) for name in column).strip()
-            if isinstance(column, tuple)
-            else column
-            for column in processed_df.columns
-        ]
-        processed_df.index = [
-            " ".join(str(name) for name in index).strip()
-            if isinstance(index, tuple)
-            else index
-            for index in processed_df.index
-        ]
-
+                
         if query["result_format"] == ChartDataResultFormat.JSON:
+            # Flatten hierarchical columns/index since they are represented as
+            # `Tuple[str]`. Otherwise encoding to JSON later will fail because
+            # maps cannot have tuples as their keys in JSON.
+            processed_df.columns = [
+                " ".join(str(name) for name in column).strip()
+                if isinstance(column, tuple)
+                else column
+                for column in processed_df.columns
+            ]
+            processed_df.index = [
+                " ".join(str(name) for name in index).strip()
+                if isinstance(index, tuple)
+                else index
+                for index in processed_df.index
+            ]
             query["data"] = processed_df.to_dict()
+            
         elif query["result_format"] == ChartDataResultFormat.CSV:
             buf = StringIO()
-            processed_df.to_csv(buf)
+            processed_df.to_csv(buf, 
+                                sep=csv_export_settings.get('sep', ','), 
+                                encoding=csv_export_settings.get('encoding', 
'utf-8'), 
+                                decimal=csv_export_settings.get('decimal', 
'.'))

Review Comment:
   ```suggestion
               processed_df.to_csv(buf,
                                   sep=csv_export_settings.get('sep', ','),
                                   encoding=csv_export_settings.get('encoding', 
'utf-8'),
                                   decimal=csv_export_settings.get('decimal', 
'.'))
   ```



-- 
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]

Reply via email to