New Here and this is my first Streamlit app. All feed back welcome and wanted!

Check out this awesome Streamlit app I built

4 Likes

Welcome to the forum! Cool first concept; such a great learning tool!

2 Likes

@jqts369 nice app, i’d recommend u some error handling, if the last person is clicked (the data aint there) it throws a python error… for lazy people i try to wrap it in a try: except and do a st.warning(“something went wrong”) or put explicit errors. but great job for your first project!

1 Like

Thanks for the feed back! I actually already had some try and except I am 100% one of those lazy people at times haha. 60% of the time all the time - True story

But my error was actually here

    # Function to format large numbers with appropriate labels (Million, Billion, Trillion)
    def format_large_number(value):
        sign = '-' if value < 0 else ""
        value = abs(value)
        if value is None or math.isnan(value):
            return "No Data"
        
        if value >= 1e12:
            return f"{sign}${value / 1e12:,.2f} Trillion"
        elif value >= 1e9:
            return f"{sign}${value / 1e9:,.2f} Billion"
        elif value >= 1e6:
            return f"{sign}${value / 1e6:,.2f} Million"
        else:
            return f"{sign}${value:,.2f}"

All i did was move the logic around in both the year and president and BOOMSAUCE! Fixed lol

Here is how i solved it:

    # Function to format large numbers with appropriate labels (Million, Billion, Trillion)
    def format_large_number(value):
        
        if value is None or math.isnan(value):
            return "No Data"
        value = abs(value)
        sign = '-' if value <0 else ""
        if value >= 1e12:
            return f"{sign}${value/1e12:,.2f} Trillion"
        elif value >= 1e9:
            return f"{sign}${value/1e9:,.2f} Billion"
        elif value >= 1e6:
            return f"{sign}${value/1e6:,.2f} Million"
        else:
            return f"{sign}${value:,.2f}"

@jqts369 Maybe another thin (just UI/UX and not about issues in your code)

I usualy prefer “Configurations” like year/president selector and range selector inside the sidebar. So it feels more intuitive for people working on landscape monitors (i didnt catch it the first time because all my screens are verticals). I heard a lot of (non IT) people get confused with scrolling :smiley:

1 Like

Loved this idea! I did it but I am having problem centering excel style table so that is an issue for another day. I want to continue learning Azure Dev ops for work. Today I tested my first branch, pull request, and merge. :slight_smile: