This is an automated email from the ASF dual-hosted git repository.

elizabeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 29b4c40e43 feat(reports): removing index column (#32366)
29b4c40e43 is described below

commit 29b4c40e439997d13aa5fcd883f8fd099d78a1df
Author: SkinnyPigeon <[email protected]>
AuthorDate: Thu Mar 13 00:27:07 2025 +0100

    feat(reports): removing index column (#32366)
---
 superset/charts/client_processing.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/superset/charts/client_processing.py 
b/superset/charts/client_processing.py
index a66531f7b5..1bf263f67a 100644
--- a/superset/charts/client_processing.py
+++ b/superset/charts/client_processing.py
@@ -353,6 +353,9 @@ def apply_client_processing(  # noqa: C901
         query["coltypes"] = extract_dataframe_dtypes(processed_df, datasource)
         query["rowcount"] = len(processed_df.index)
 
+        # Check if the DataFrame has a default RangeIndex, which should not be 
shown
+        show_default_index = not isinstance(processed_df.index, pd.RangeIndex)
+
         # 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.
@@ -377,7 +380,7 @@ def apply_client_processing(  # noqa: C901
             query["data"] = processed_df.to_dict()
         elif query["result_format"] == ChartDataResultFormat.CSV:
             buf = StringIO()
-            processed_df.to_csv(buf)
+            processed_df.to_csv(buf, index=show_default_index)
             buf.seek(0)
             query["data"] = buf.getvalue()
 

Reply via email to