From 084ddc26d399e43601d2d985e39ddcbf22c1726b2bb49267454ea3876643bc01 Mon Sep 17 00:00:00 2001 From: Moses Rolston Date: Sun, 9 Mar 2025 13:07:53 -0700 Subject: [PATCH] checkpoint --- api/endpoints/get_sponsored.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/endpoints/get_sponsored.py b/api/endpoints/get_sponsored.py index b1efaf7..5035cf3 100644 --- a/api/endpoints/get_sponsored.py +++ b/api/endpoints/get_sponsored.py @@ -33,6 +33,14 @@ def write_to_csv(legislation_data, csv_file): flattened_legislation.append(flattened_item) df = pd.DataFrame(flattened_legislation) + + # Debugging: Print the first few entries of the DataFrame to inspect its structure + print("Debugging DataFrame:") + if not df.empty: + print(df.head()) + else: + print("DataFrame is empty.") + if df.empty: neo4j_logger.warning(f"No data to write to CSV file: {csv_file}") print("DataFrame is empty. Debugging information:") @@ -40,10 +48,6 @@ def write_to_csv(legislation_data, csv_file): print(json.dumps(item, indent=4)) return - # Debugging statement to check DataFrame contents - print("DataFrame contents:") - print(df.head()) - df.to_csv(csv_file, index=False) neo4j_logger.info(f"Data written to CSV file: {csv_file}")