Python Interactive Dashboards with Plotly Dash - Quick Tutorial
ฝัง
- เผยแพร่เมื่อ 8 ก.ย. 2024
- An intro to plotly Dash in Python with a real-world dataset example.
Build interactive, nice-looking, easily sharable, and web-based dashboards in Python!
- For better learning of Dash, check out our Udemy course:
www.udemy.com/...
- To download the avocado dataset used in the video:
www.kaggle.com...
- Try out the dashboard in the video deployed on Heroku:
python-dash-tu...
There's also an article of the same content, if you prefer reading, check out www.justintoda...
Dash has made multiple changes after upgrading to version 2.x.
We can't modify this video. So for an updated version, please visit our website for the article www.justintodata.com/python-interactive-dashboard-with-plotly-dash-tutorial/.
Or our course on Udemy www.udemy.com/course/python-interactive-dashboards-with-plotly-dash/?referralCode=27BF272291E2106DA590
Is the Udemy course updated to the new version? or its just fundamentals and can be apply to any of the versions?
Hi@@fayalessa7315 Yes, the Udemy course has been updated to the new version.
just went to the tutorial link and the code worked wonderfully. Thank you!
Very excellent explaination Justin. Thank you very much for the efforts you put to make us understand about the dash layout and callback.
Very well-made video. The pacing and the quality of the presentation of all the content is 100% useful, every second. Thanks!
Excellent video! Got my first dashboard up and running thanks to you.
Awesome!!! TQVM!! All new to me. A great introduction video for me!
Such a well composed video tutorial, thank you so much Lianne
This was a great video, Simple and easy to understand.
Good stuff - could this be made "live" - like in a real time display of data being generated in real time.
Very nice explanation
Great video. Please advise on how to cluster data and use mutiple drop drowns. For example grouping the cities by state and then accessing the cities. This would help for a company with a large number of products but need to access data by category first before individual products.
Thank you for the video. It is very helpful :) !
built my first dashboard! yeeeeeeeeeeeeeeeeeey
such a great work! Thank you thank you thank you...
Great video 👍🏾
Hi, Your lectures are really useful to create dashboards using plotly dash in efficient way. Just have one questions ? How we can export these dashboards either in PDF or PPT using dash?
Hi Shashikant, I don't think Dash offers any functions like that. You probably have to use other packages to do that
@@justintodata Thanks for your reply. Can you please suggest other packages that may be useful??
@@shashikantrrathod3617 I haven't had to do anything similar. Perhaps try out something mentioned in this thread stackoverflow.com/questions/52820266/how-do-i-display-a-website-written-in-dash-as-a-static-pdf-python
Useful content!
How to upload csv data in real time??
Hi Francisco, I've never done it myself. But I'm guessing you need to automate updating the csv file in Python and get Dash to read it. Dash can use interval component to read periodically
How does the dcc.Graph object know which graph to show? The update_graph function doesn't have an id attached to it
Hi Pranav, around 9:20, it mentioned that the function returns line_fig, corresponds to the Output in @app.callback, which has id of dcc.Graph
can i get the github repo for this
I am building a desktop app in Python and mySQL which requires some reporting - Dash and Plotly seem to be good choice. Is it possible to add Dash+Plotly as reporting functionality from desktop app (click on button in the app, and web browser opens with reporting tool build in Dash/Plotly) and compile such app into an exe? What I mean is - will the Dash/Plotly functionalities work if I compile such app to exe?
Hi Mladen, we've never had to do it ourselves. But sounds like this article is solving the problem, python.plainenglish.io/how-to-convert-your-dash-app-into-an-executable-gui-b1d4271a8fa7
But how do you make dash update itself every some interval, as data come in?
Hi, please check out dash.plotly.com/live-updates
How to generate dashboard for data from MySQL database????
Hi Ram, you'll need to connect from Python to your database, and grab the data as pandas DataFrame. Then you can use Dash to create a dashboard based on it
Hi, liked this tutorial. I have run into an error while executing the code. Would you be able to help me please? I am new to plotly/dash and relatively new to Python itself. Thanks.
The error is:
Traceback (most recent call last):
File "dash_example.py", line 26, in
@app.callback(
File "C:\RAOUL\Python\PycharmProjects\PLOTLY DASHBOARDS WITH DASH\venv\lib\site-packages\dash\dash.py", line 1000, in callback
callback_id = self._insert_callback(output, inputs, state, prevent_initial_call)
AttributeError: 'Output' object has no attribute '_insert_callback'
Hi Raoul,
We've never had that error message before so it's hard to say without seeing your code and your environment. But it looks like something to do with your Dash installation. Maybe try to reinstall it again?
Can we share this link to someone else to see the graph??
Hi Fahad, I'm guessing you are talking about the final deployed dashboard. You're welcome to share it for your personal use.
my chart to produce show the title. where should i look for the problem?
Sorry, you mean you can't see the title of the plotly chart or you want to remove the title? You can change the title in the callback function.
@@justintodata I've experienced something similar. My title and axis titles do not show and more importantly the custom data on mouse hover also does not show...is something wrong with plotly express and dash.....do we have to switch plotly graph objects?
@@rupinchaudhry592 Hi Rupin, we just tried to run it again on our environment. It is ok. Maybe try a different version of Dash or a different browser.
@@justintodata got it. my dash library was outdated
Thanks
Can i try this using M1 Apple Silicone?
Hi Gabriel, we are not really experts in hardware. But it should work if you can run Python on it.
Justin2Data is a better name
Thanks a lot for this very we'll explained tutorial. I should only suggest that the "import" would be a lot simpler if written as "from dash import Dash, dcc, html, Input, Output" (and of course the corresponding modified "app = Dash()" line). But my code being identical to yours I am not getting the dropdownbox displayed and in the browser get the following error:
Invalid argument `options` passed into Dropdown with ID "geo-dropdown".
Value provided:
[
{
"label": "Albany",
"value:": "Albany"
},
{
"label": "Atlanta",
"value:": "Atlanta"
},
....
{
"label": "West Tex/New Mexico",
"value:": "West Tex/New Mexico"
}
]
not understanding what's wrong. Any ideas?
FWIW if I replace your "options" line with a simple "options=avocado["geography"].unique()," the code works as it should
@@RobertAlexanderRM Hi Robert, Dash has updated to a newer version in recent months.
So now you can use a simpler import statement and provide a list of strings as the options of Dropdown. But the list of dictionaries should still work.
i wish i was smarter so i could understand this :(
Hi. Thanks for the video, it's extremely informative and helpful.
Can you help me with a persistent issue that I am currently facing? Whenever I am trying to import dash_core_components or dash_html_components or dash_bootstrap_components in jupyter , it's throwing an import error, stating cannot import _explicitize_args , has anyone faced this issue here? Please help. Can elaborate more if someone wants. Thanks in advance!
P.s I am using dash 1.20.0 , which I believe is the latest version
yep! those imports are deprecated so you may want to use: from dash import dcc
instead of the two import methods you mentioned