import streamlit as st import pandas as pd # Set the page layout to wide mode st.set_page_config(layout="wide") # Load the data df = pd.read_csv('output_sorted.csv') company_overviews = pd.read_csv('company_overview.csv') # Merge the dataframes on the ticker/Symbol column df = df.merge(company_overviews, left_on='ticker', right_on='Symbol', how='left') # Sort the data by NapolRating df_sorted = df.sort_values(by='NapolRating', ascending=False) # Get the top 50 to buy (highest NapolRating) top_50_buy = df_sorted.head(50) # Get the top 50 to sell (lowest NapolRating) and sort them in ascending order top_50_sell = df_sorted.tail(50).sort_values(by='NapolRating') # Function to determine emoji based on Napol score def get_performance_emoji(score): if score >= 90: return "🦄" elif score >= 85: return "🗿" elif score > 50: return "👍" elif score <= 20: return "💩" elif score <= 20: return "🙈" elif score <= 50: return "👎" else: return "" # Empty string for other scores # Center-align the title and columns # Center the image and text st.image('napol.png', use_column_width=True) st.markdown("**Hi! 👋🏻 Napol is an AI stock picker that you can use to make smart LONG TERM investments and keep track of them.**", unsafe_allow_html=True) st.markdown("V1 is made analyzing a dozen metrics of S&P500 companies for 1 year. It's static as of June 30 2024. V2 will use an AI model trained from 30 years of financial reports data of S&P500 companies. V3 will integrate live data to update the scores frequently. V4 will include model optimizations and accuracy tests. The yearly % growth provided by the model will be reported. V5 will allow users to add stocks to their portfolio and get updates when its time to sell. Following versions will include more stocks from different markets, a newsteller and a pro plan.", unsafe_allow_html=True) st.markdown("If you are interested, leave a ❤️ to this space.", unsafe_allow_html=True) st.markdown("---") # Divider for better visual separation col1, col2 = st.columns(2) def create_stock_box(row, color): # Get the performance emoji based on Napol score performance_emoji = get_performance_emoji(row['NapolRating'] * 100) return f"""