YashMK89 commited on
Commit
53916c0
·
verified ·
1 Parent(s): da99172

update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -368,19 +368,24 @@ if st.session_state.results:
368
  # Convert the results to a DataFrame for better visualization
369
  result_df = pd.DataFrame(st.session_state.results)
370
 
371
- # Show the results in a table format
372
- st.write("Processed Results Table:")
373
- st.dataframe(result_df[['Location Name', 'Latitude', 'Longitude', 'Calculated Value']])
 
 
 
 
 
 
374
 
375
  # Generate the dynamic filename
376
  filename = f"{main_selection}_{sub_selection}_{start_date.strftime('%Y/%m/%d')}_{end_date.strftime('%Y/%m/%d')}_{shape_type}.csv"
377
 
378
  # Convert results to DataFrame for download
379
- if st.session_state.results:
380
- result_df = pd.DataFrame(st.session_state.results)
381
- st.download_button(
382
- label="Download results as CSV",
383
- data=result_df.to_csv(index=False).encode('utf-8'),
384
- file_name=filename,
385
- mime='text/csv'
386
- )
 
368
  # Convert the results to a DataFrame for better visualization
369
  result_df = pd.DataFrame(st.session_state.results)
370
 
371
+ # If the shape type is 'Point', include 'Latitude' and 'Longitude'
372
+ if shape_type.lower() == 'point':
373
+ # Show the results in a table format with Latitude and Longitude
374
+ st.write("Processed Results Table (Points):")
375
+ st.dataframe(result_df[['Location Name', 'Latitude', 'Longitude', 'Calculated Value']])
376
+ else:
377
+ # For polygons, we only show the Location Name and Calculated Value
378
+ st.write("Processed Results Table (Polygons):")
379
+ st.dataframe(result_df[['Location Name', 'Calculated Value']])
380
 
381
  # Generate the dynamic filename
382
  filename = f"{main_selection}_{sub_selection}_{start_date.strftime('%Y/%m/%d')}_{end_date.strftime('%Y/%m/%d')}_{shape_type}.csv"
383
 
384
  # Convert results to DataFrame for download
385
+ st.download_button(
386
+ label="Download results as CSV",
387
+ data=result_df.to_csv(index=False).encode('utf-8'),
388
+ file_name=filename,
389
+ mime='text/csv'
390
+ )
391
+