Community Showcase: League of Legends Diamond Tier Analysis with Preswald
We're thrilled to feature Nikita Levin in this edition of the Preswald Community Showcase! 🎉 Nikita has built a data-rich Preswald app that analyzes League of Legends 10-minute gameplay data from high Diamond-ranked matches, revealing how early-game statistics impact match outcomes.
🌟 Project Overview
📊 Preswald and Diamond Tier LoL Analytics
This blog explores how Preswald can be used to dissect League of Legends match data, allowing players, coaches, and analysts to assess early-game performance indicators like kills, wards, and gold generation in a competitive tier.
Project Name: Diamond Tier 10-Minute Analytics Built by: Nikita Levin Dataset: High Diamond Ranked LoL Match Data (10-min snapshot)
📊 Description
Nikita's project provides an interactive dashboard for understanding 10-minute match metrics. Users can:
<li>**Filter matches** with high early-game warding or kill counts. </li><li>**Analyze distribution and correlation** of game metrics. </li><li>**Compare performance patterns** between winning and losing teams. </li><li>**Visualize trends** through box plots, heatmaps, and dynamic tables. </li>With Preswald, Nikita built an interactive app for League of Legends competitive analysis, requiring no frontend coding.
🚀 Code Snippets
Load and Filter Data
from preswald import connect, get_df, query, table, text
connect()
df = get_df("highdiamond")
sql = "SELECT * FROM highdiamond WHERE blueWardsPlaced > 50"
filtered_df = query(sql, "highdiamond")
text("# High Diamond Ranked 10min Data Analysis")
table(filtered_df, title="Filtered Data (blueWardsPlaced > 50)")
Dynamic Filtering with Sliders
from preswald import slider
kill_threshold = slider("Minimum Blue Kills", min_val=0, max_val=30, default=10)
ward_threshold = slider("Minimum Blue Wards Placed", min_val=0, max_val=200, default=50)
slider_filtered_df = df[(df["blueKills"] >= kill_threshold) & (df["blueWardsPlaced"] >= ward_threshold)]
table(slider_filtered_df, title="Games Passing Both Thresholds")
Visualizing Kill Distribution
import plotly.express as px
fig_hist = px.histogram(df, x="blueKills", nbins=20, title="Histogram of Blue Kills")
plotly(fig_hist)
Gold Box Plot by Match Outcome
fig_box = px.box(df, y="blueTotalGold", color="blueWins", title="Blue Team Total Gold by Outcome")
plotly(fig_box)
Correlation Heatmap
numeric_cols = [
"blueKills", "blueDeaths", "blueWardsPlaced", "blueTotalGold",
"redKills", "redWardsPlaced", "redTotalGold"
]
corr_df = df[numeric_cols].corr()
fig_heatmap = px.imshow(
corr_df, text_auto=True, title="Correlation Matrix",
color_continuous_scale="RdBu_r", zmin=-1, zmax=1
)
plotly(fig_heatmap)
Aggregate Win/Loss Stats
sql_agg = """
SELECT
blueWins,
AVG(blueWardsPlaced) AS avgWards,
AVG(blueKills) AS avgKills,
AVG(blueTotalGold) AS avgGold
FROM highdiamond
GROUP BY blueWins
"""
aggregated_df = query(sql_agg, "highdiamond")
table(aggregated_df, title="Average Wards, Kills, and Gold by Win/Loss")
Quick Stats Overview
games_count = len(df)
blue_wins = df["blueWins"].sum()
win_rate = (blue_wins / games_count) * 100
text(f"- **Total Games**: {games_count}")
text(f"- **Blue Side Wins**: {blue_wins}")
text(f"- **Blue Side Win Rate**: {win_rate:.2f}%")
📊 What is Preswald?
Preswald is an open-source framework for building data apps, dashboards, and internal tools with just Python. It provides pre-built UI components like tables, charts, and forms, so you don't have to write frontend code.
Preswald tracks state and dependencies, making computations efficient by updating only when necessary. It uses a workflow DAG to manage execution order, ensuring performance and predictability.
Key Features
<li>Add UI components to Python scripts: user-interactive buttons, sliders, tables, and charts </li><li>Structured computation using a DAG-based model </li><li>Deploy with one command and share via link </li><li>Cloud or local hosting </li>🚀 Getting Started
Installation
pip install preswald
Quick Start
preswald init my_project
cd my_project
preswald run
Deploy to Structured Cloud
preswald deploy --target structured
Huge Thanks to Nikita Levin!
A big thank you to Nikita Levin for building such an exciting esports analytics app with Preswald!
Want to Contribute?
Got a cool idea for a Preswald app? We'd love to see it! Get started here: <a target="_blank" rel="noopener noreferrer nofollow" class="text-blue-600 hover:text-blue-800 underline" href="https://github.com/StructuredLabs/preswald">https://github.com/StructuredLabs/preswald</a> and you might be featured in our next Community Showcase.
Happy building! 🌟🚀