From 14a7b1bbabad15aa2c79092080d7214784bda730 Mon Sep 17 00:00:00 2001 From: rohitpawar2811 Date: Mon, 5 Feb 2024 18:05:17 +0530 Subject: [PATCH] Improved: Make checks more better which can identify the index column --- superset/commands/report/execute.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/superset/commands/report/execute.py b/superset/commands/report/execute.py index 46715296d6..21dad4a4df 100755 --- a/superset/commands/report/execute.py +++ b/superset/commands/report/execute.py @@ -258,11 +258,9 @@ class BaseReportState: if csv_data: buf = BytesIO() temp_df = pd.read_csv(StringIO(csv_data.decode("utf-8"))) - if temp_df.columns[0] == "": - csv_data = temp_df.iloc[:, 1:] - csv_data.to_csv( - buf, encoding="utf-8", index=app.config["CSV_INDEX"] - ) + if temp_df.columns[0].strip() == "Unnamed: 0": + temp_df = temp_df.iloc[:, 1:] + temp_df.to_csv(buf, encoding="utf-8", index=app.config["CSV_INDEX"]) buf.seek(0) csv_data = buf.getvalue() except SoftTimeLimitExceeded as ex: