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-plotly-demos
???? ????????????????????????????????:
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-plotly-demos
???? Twitter: https://twitter.com/bugbytesio
???? ???????????????????????????? ???????????????????????????? ???????????? ????????????????????????????????????????????:
Dataset: https://github.com/selva86/datasets/blob/master/Wage.csv
Plotly Scatter Plots: https://plotly.com/python/line-and-scatter/
Plotly Box Plots: https://plotly.com/python/box-plots/
Django Conditional Expressions: https://docs.djangoproject.com/en/4.1/ref/models/conditional-expressions/
#python #django #plotly #aggregation