From 7138a957492cd0b1262b40a2de2d8e977c5bc51c Mon Sep 17 00:00:00 2001 From: Pr Janitor Date: Sat, 4 Apr 2026 05:18:01 +0300 Subject: [PATCH] Fix DataFrame concatenation logic in get_sub_df Remove redundant condition check that was causing incorrect DataFrame construction. --- csv-json.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/csv-json.py b/csv-json.py index 00e7cc1..c4ad141 100644 --- a/csv-json.py +++ b/csv-json.py @@ -35,11 +35,10 @@ def get_sub_df(response): return pd.DataFrame({"No Data In Base": []}) else: dff = pd.DataFrame(stringify(response['records'][0]['fields']), index=[0]) - if len(response['records']) > 0: - for i,r in enumerate(response['records']): - if i != 0: - dfb = pd.DataFrame(stringify(response['records'][i]['fields']), index=[i]) - dff = pd.concat([dff, dfb]) + for i,r in enumerate(response['records']): + if i != 0: + dfb = pd.DataFrame(stringify(response['records'][i]['fields']), index=[i]) + dff = pd.concat([dff, dfb]) return dff