In this video, we will learn how to create scatter plots, box plots and line charts using Plotly, and embed these into a Django template. We will be plotting a person's age and their salary, to see if a correlation exists.
We will learn how to use Case and When objects in Django to create conditional expressions that can be used to annotate objects in our QuerySets.
We'll also learn to use colour to differentiate points on a scatter-plot based on a third feature, and how to draw the trend line (the line of best fit) through a scatter plot using Plotly.
Starter code: https://github.com/bugbytes-io/django...
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:31 Creating Django model from the data
03:14 Loading CSV data with a Django management command
05:29 Fetching database records in Django view
07:05 Creating and rendering a scatter plot with Plotly and Django
11:56 Filtering data and colour-coding scatter plot by Education Status
14:50 Showing data distributions with Plotly box-plots
16:17 Grouping and aggregating Django QuerySets with Conditional Expressions
18:22 Django ORM When and Case expressions
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://www.bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/django...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Dataset: https://github.com/selva86/datasets/b...
Plotly Scatter Plots: https://plotly.com/python/line-and-sc...
Plotly Box Plots: https://plotly.com/python/box-plots/
Django Conditional Expressions: https://docs.djangoproject.com/en/4.1...
#python #django #plotly #aggregation