a table with all the scoring leaders in the nba
To upload files, please first save the app
import streamlit as st
import pandas as pd
st.title("NBA Scoring Leaders")
# NOTE: Using corsproxy.io because we're in a WASM environment. If running locally,
# you can remove the corsproxy.io prefix.
url = "https://corsproxy.io/?https://raw.githubusercontent.com/hkwgc/nba-career-stats-all-time/master/nba.csv"
data = pd.read_csv(url)
# Sort by points per game in descending order
scoring_leaders = data.sort_values(by='PTS', ascending=False).head(50)
# Select relevant columns
display_columns = ['Player', 'PTS', 'GP', 'AST', 'TRB', 'FG%', '3P%', 'FT%']
scoring_leaders = scoring_leaders[display_columns]
# Format the percentages
for col in ['FG%', '3P%', 'FT%']:
scoring_leaders[col] = scoring_leaders[col].apply(lambda x: f"{x:.1f}%")
# Display the table
st.write("Top 50 NBA Scoring Leaders (Points Per Game)")
st.table(scoring_leaders)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?