Manasa1 commited on
Commit
1cfde01
·
verified ·
1 Parent(s): c585f5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -21,7 +21,7 @@ def fetch_esg_data(company_name):
21
  esg_data = stock.sustainability
22
 
23
  # If ESG data is available, process it into a DataFrame
24
- if esg_data is not None:
25
  esg_df = pd.DataFrame(esg_data)
26
 
27
  # Extract only the relevant ESG scores and convert to a DataFrame
@@ -39,8 +39,7 @@ def fetch_esg_data(company_name):
39
 
40
  return plot_df, csv_filename # Return the plot DataFrame and the CSV filename
41
  else:
42
- # Return an empty DataFrame and None if no data is available
43
- return pd.DataFrame(), None
44
 
45
  # Gradio interface with a dropdown for company selection, line plot visualization, and CSV download
46
  def app_interface():
@@ -75,3 +74,4 @@ def app_interface():
75
  app = app_interface()
76
  app.launch()
77
 
 
 
21
  esg_data = stock.sustainability
22
 
23
  # If ESG data is available, process it into a DataFrame
24
+ if esg_data is not None and not esg_data.empty:
25
  esg_df = pd.DataFrame(esg_data)
26
 
27
  # Extract only the relevant ESG scores and convert to a DataFrame
 
39
 
40
  return plot_df, csv_filename # Return the plot DataFrame and the CSV filename
41
  else:
42
+ return pd.DataFrame(), None # Return empty DataFrame and None if no data is available
 
43
 
44
  # Gradio interface with a dropdown for company selection, line plot visualization, and CSV download
45
  def app_interface():
 
74
  app = app_interface()
75
  app.launch()
76
 
77
+