poemsforaphrodite commited on
Commit
11de6fa
1 Parent(s): 0f3abc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -278,7 +278,7 @@ def analyze_competitors(row, co, country_code):
278
 
279
  # Create DataFrame
280
  results_df = pd.DataFrame(results)
281
- results_df['Position'] = results_df['Position'].astype(int)
282
 
283
  # Mark our URL
284
  results_df['URL'] = results_df.apply(
@@ -663,7 +663,7 @@ def show_tabular_data(df, co, country_code):
663
  cols[3].write(row.clicks)
664
  cols[4].write(row.impressions)
665
  cols[5].write(f"{row.ctr:.2%}")
666
- cols[6].write(f"{row.position:.1f}")
667
  cols[7].write(f"{row.relevancy_score:.4f}" if not pd.isna(row.relevancy_score) and row.relevancy_score != 0 else "N/A")
668
 
669
  # Competitors column
@@ -689,7 +689,7 @@ def show_tabular_data(df, co, country_code):
689
 
690
  # Update the Position for our URL
691
  our_url_mask = results_df['URL'].str.contains('Our URL')
692
- results_df.loc[our_url_mask, 'Position'] = row.position
693
 
694
  # Ensure our URL's score matches the main table
695
  results_df.loc[our_url_mask, 'Score'] = row.relevancy_score
@@ -703,7 +703,7 @@ def show_tabular_data(df, co, country_code):
703
  # Apply the custom style and hide the index
704
  styled_df = results_df.style.apply(highlight_our_url, axis=1).hide(axis="index")
705
 
706
- # Display the styled DataFrame
707
  st.markdown(styled_df.to_html(), unsafe_allow_html=True)
708
 
709
  # Extract our result for additional insights
 
278
 
279
  # Create DataFrame
280
  results_df = pd.DataFrame(results)
281
+ results_df['Position'] = results_df['Position'].astype(int) # Ensure Position is integer
282
 
283
  # Mark our URL
284
  results_df['URL'] = results_df.apply(
 
663
  cols[3].write(row.clicks)
664
  cols[4].write(row.impressions)
665
  cols[5].write(f"{row.ctr:.2%}")
666
+ cols[6].write(f"{int(row.position)}") # Round Position to integer
667
  cols[7].write(f"{row.relevancy_score:.4f}" if not pd.isna(row.relevancy_score) and row.relevancy_score != 0 else "N/A")
668
 
669
  # Competitors column
 
689
 
690
  # Update the Position for our URL
691
  our_url_mask = results_df['URL'].str.contains('Our URL')
692
+ results_df.loc[our_url_mask, 'Position'] = row.position # Already integer
693
 
694
  # Ensure our URL's score matches the main table
695
  results_df.loc[our_url_mask, 'Score'] = row.relevancy_score
 
703
  # Apply the custom style and hide the index
704
  styled_df = results_df.style.apply(highlight_our_url, axis=1).hide(axis="index")
705
 
706
+ # Display the styled DataFrame with Position as integer
707
  st.markdown(styled_df.to_html(), unsafe_allow_html=True)
708
 
709
  # Extract our result for additional insights