Python Interactive Dashboard Development using Streamlit and Plotly

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone I hope you are doing well I am very excited for this session and this session is basically designed for interactive python dashboard application using streamlit so guys in this video I will tell you how you can design the interactive dashboard application from scratch using python plotly streamlit Etc all right and sometimes people think can we design a interactive dashboard like power bi and tablet using python streamlit so guys answer is yes we can easily design interactive dashboard using python streamlit okay so you can see here right these kind of snapshot I have from the design dashboard okay so now let me tell you the designing and working functionality of this dashboard all right so guys this is the sample Superstore data and here we have row ID order ID or a date sip date ship mode customer ID customer name segment country what kind of city and state we have postal reason right and apart from that we have some product items information let's say product ID category subcategory products sales quantity discount and profit so this is a very simple lean and clean data you can easily download from web okay and I will share this data as well so guys now let me tell you the application looks and its functionalities all right so guys this is the look and feel of this dashboard if user want to upload the data set so simple user can click on browse and they can upload the data simple and if you want to you know choose some specific period based on the start date and and date so you can easily select any particular date and Sim simple here you can also choose any kind of date or you want right and again if you want to filter the data based on this you can filter the data is easy okay so I will be tell you each and everything from this scratch how you can build now this is the category wise sales segment by sales and if you want to see the data you can see the data and you can download as well now time series analysis and here the radical view of sales using the tree map again some charts and plots and here you can you know expand the data so you can see the data each and everything and simple and here I have built the relationship between profit and sales using the scatter plot again you can view the data and download the data so guys let's start how we can build this application from scratch end to end so guys let me launch my vs code and here let me create a file so simple dashboard Dot py so guys first of all let me import the necessary libraries so first of all I want to streamlit as St an ID of plotly right so guys using the plotly we can you know generate the charts and I need a pandas for data handling or I need for OS in case I want to navigate some files or in case if I am getting some kind of warnings so I want to ignore those volume all right so simple filter warnings and ignode very easy all right now guys first of all let me set the titles of the page or maybe some icon or maybe some layout okay so simple St and here the set page config and guys first of all let me add the page title you can see here and the page title is nothing simple let's say Superstore so any title you can Define based on your understanding and guys here I want to supply the page icon okay so page icon so I will be explain about the page icon so let me write here the bar chart and guys the layout I want wide so guys it is very simple so guys if you are really interested to explore more icon right then you can jump official Rampage of streamlit icons all right so let me tell you how we can do that so simple you can type here the streamlit Emojis icons simple okay so you can see here this is the official webpage of the streamlit Emojis okay so based on your understanding or based on your requirement whatever the icon you want to create or you want to you know include in your dashboard so you can easily include so here let's say I have written the bar chart right so this particular bar chart will be appear in case you want to include this so you have to write this particular line of statement okay so I will give you this link so that you can easily use it all right first of all let me set the title of this dashboard application as well okay so what I am doing here St dot title and simple guys again I want bar chart and sample Superstore Eda right whatever you want you can supply so guys now let me run these two lines okay then we'll see what will happen so simple you can click run python file and here let me write stream lit run and dashboard.py so guys this is very simple steam lit run dot dashboard dot py right so let me check let's see what kind of exception I am getting here so Windows error so an attempt was made to access a socket in a waveform to access the permission so guys in case let's say if your particular Port is busy right so you can include your you know some random Port as well okay in case you are finding this kind of you know exception so what you can do here so simple streamlit run dashboard Dot py and here you can write server dot Port so double eight double A okay or you can use eight zero eight zero okay now let's try this so guys it's working right so guys you can see here we have launched this Superstore application but we have written the wrong spell okay so now let me do one thing so this is the chart now let me save it let me run it so you can see here I'm getting the you know paste title which is super store here and here I am getting the dashboard title as well all right but now you can see here it would be great if you can set this title little bit up okay so it would be great because right now it is showing from here but I want from here okay so how we can do that so guys simple I will be using St dot markdown okay and here I am using some CSS concept so simple Style div dot block container and guys let me use some padding from the top maybe I want to you know leave up online and star okay and here unsafe allow HTML equal to true okay now so you can see here right so now it is looks good all right so guys here I am using the sd.markdown function and I have included the block of HTML code that contains CSS styling information and here I have defined the styled rule right so for a div element right I am using a class of block container and to add some padding to the top of the element all right so this is very easy now guys let me tell you how a user can browse and upload the data for this dashboard okay so simple I am here I am taking a FL equal to St dot file uploader okay so using this particular function a user can upload a file and here guys again I am using you know some uh some kind of Icon let's say file folder so guys I have remembered these kind of you know basic icons code okay and here I am writing let's say upload a file a file and here you can choose the type okay in case you want to choose the type so for an example let's say I want CSV I want txt I want Excel SX or maybe XLS right and simple if you are not choosing the file then what will happen so means none so the file you are not selecting right so if file is not none not none then what I want so simple file name equal to FL dot name okay and then St and here guys right file name and now I want to read the CSV okay so DF equal to PD Dot read CSV and the file name is whatever the file name you will be choose simple okay and else let me change the directory Okay so OS dot c h d i r so so guys right now I am working in this directory simple and now I want to read the data okay so DF equal to PD dot read CSV and here again I am using sample Superstore so let me check the file name Superstore okay and now let me run this so guys you can see here I am getting you know Unicode decode error so this is the common error in case you are reading some CSV okay so in this case let's say you have to use the encoding mechanism like ISO double eight five nine and one so you can remember this ISO kind of numbers and similarly I am using here encoding simple okay now let me run this or read CSV encoding encoding so simple here you can browse and you can upload the data simple all right now the main development will be start for this dashboard okay so first of all let's create a date picker okay so user can select the specific period of the data so guys first of all what I am doing I am going to create a column 1 and the column two all right and here St dot columns and the columns is how many columns I want so guys I want only the two columns okay so using this line I am creating a two columns for start date and and date so guys first of all I am going to convert my order date right so I have the order date in the data so PD dot two data frame and here the column name order date I am going to convert into the date and time all right now let's see how you can decide the the date from where your date is going to start in from the order date okay so how we can decide so first of all what I want I am getting the Min and Max date from this column okay so how we can do that so guys simple first of all let's say start date equal to PD Dot uh two date time okay or you can write you know this line once again in case you want or directly you can also use it DF of order date and here guys I want dot Min okay so main data I want similarly I can take the max state that will be and date right so simple Max date easy after that let's say what I want so first of all let's say I have created the column one and two so column one now date 1 equal to PD 2 date and time and here s t date input guys I am taking and here I am going to write start date and here I can supply that particular variable name to start date simple and here uh with the column 2 also I will be do the same thing so this is the date one and this is the date two all right and that will be a and date simple okay now what I want so if you select any specific date from the date 1 and date two based on that your data Frame data will be updated so DF equal to now how we can filter the data guys so it is very easy to filter the data so let's say DF and again order date and greater than equal to date one and for the same thing for the order date Which is less than equal to date 2. all right now I want to use the copy okay so if you are going to select the data based on the small date or you can say that start date or end it so your data will be reflected the DM okay now let me run the same thing so guys you can see here right so this is the start date and this is the end date all right so if you will select this you can choose any specific date simple okay now your data will be saved in DF automatically okay now let's create a side filter pane to filter the data based on reason to state and city okay so what I'm doing here St Dot sidebar dot header and here I am writing choose your filter simple and I am taking a reason let's say St dot sidebar and guys multi-select and here I am right writing pick your reason or pick the reason whatever you want you can write it and here DF which is reason and guys I want only the unique reason whatever the unique reason I have simple now let me save this so you can see here I am getting the unique reason right Southwest Central and East okay so guys what if if you are not choosing any reason then what will happen okay so what I'm saying try to understand here if not reason if it means let's say you are not selecting any reason then what will happen so I am taking a another data frame as a df2 and here whatever the data you are getting from the DF that data I am going to store in the df2 else else means let's say if you are going to choose any reason right is in and here I am going to supply this reason because you are going to choose the reason from the multi select so that information will be stored in the reason so using this line of a statement I can filter the specific reason into the df2 simple now the same thing I have to perform for the create for the state and guys this is for the create for reason now I have to perform the same thing for the state so let's say State equal to again sidebar and here I am also giving you the multi select option and again pick the state or pick your state and again df2 State and unique so try to understand what is happening here so if you will select the reason maybe you select the east region So based on that I want to choose only the East reason state okay so that's why I am writing here the df2 simple or again if you are not selecting any state then so again the df3 equal to df2 dot copy if you are choosing the same thing I will do here as well df3 equal to df2 and again the state is in and the state all right now let me tell you so if I select the South all right now I am getting only the South State okay Kentucky Florida North Carolina virgin and so on and so forth I am going to remove this now I want let's say Central right and now I am getting those State okay so it is very easy and if you want to select the multiple so you can go with the multiple as well now you will have more State based on the Central and East all right so this is very easy and guys now the same thing I will do for the state city also okay so I hope you are understanding let's say what I whatever I am doing here so create for City so for the city again City equal to St Dot sidebar and again multi select and again let's say pick the city pick the city and here DF 3 and whatever the city you are choosing and guys again Unique City okay now the question is how to filter the data okay filter the data data based on based on reason the state and city okay so if you will apply the filter here right if you will apply the filter then how you will be store the data into the data okay so this is a very interesting concept here so guys right now let's say I am going to apply the permutation and combination so permutation and combination means let's say if you are not selecting any reason and not State and not setting then what will happen so simple if you are not choosing any reason state and filter so I am taking a filtered data frame let's say DF uh you can say that DF equal to whatever the original data set I have simple alif maybe if you are not selecting a state or not the city means you are going to choose the you are going to choose the let me change this path a filtered DF okay so if you are not choosing state and city it means you are choosing the reason okay so it's simple DF and the reason is in and here the reason and similarly alif not reason and not a state means filter DF equal to DF and here you are going to select the state not a state or you can say that not reason in not city let me go with the city first then I am saying let's say you are going to select the state and again is in and here the state variable I have declared so I have made perfectly three combination now similarly alif to state and city if you are choosing then what will happen so guys this is very interesting so filtered DF equal to d f now 3 will come into the picture okay because I have applied the filter on reason instead that I am choosing the city okay and uh so first of all I will come with the state so is in and here the state all right and df3 and if I am choosing here the is in City interesting now let me copy these two line copy and guys paste and paste so state and city I have done now I am saying reason City so simple here the reason will come now I can say that uh reason and only the state you are choosing so simple here the reason and here the state all right and now I am coming for alif if you are going to select only the city so filtered DF equal to DF 3 tf3 and here City only City I want is in City and guys else filtered DF reason is in the reason and df3 means you are selecting the state is in an estate or maybe if you are selecting the city as well all right so simple City dot is in and City okay so this is very interesting so first of all I made the combination of reason state and city then state and city then reason in City then State density simple now I am making based on the two columns if you are going to select state and city then what will happen maybe reason in city or maybe reason in state right so all the permutation and combination I have built now let me save this and we'll see what will happen so first of all let's say I am getting the South here and based on that I am getting the you know Florida whatever the state you want and then I am having the City all right now the data according will be stored in your data frame df3 simple and guys one more thing can you see here now so this is the particular hierarchy let's say I have built what if if I am going to remove the South so automatically the state will gone look at this okay so this is the beauty okay so if you want to choose the you know if you want to selecting your data based on the state although you can process right now based on that you are getting these City so if you will remove this City will remove let me tell you again so if I am choosing you know this one if I'll remove this it's gone now if you want to populate the data based on only the cities so now you will have all the city in the data set okay so this is very interesting now I want to create a column chart for category and reason okay so again what you will do so let's say I am taking a variable category DF equal to whatever the filter data frame I got so guys our filter data frame dot Group by okay and here by equal to which column so category column and here I am giving as index equal to false and I want guys some column of sales and I want some simple okay so this is very interesting now how you can create the chart okay now how you can create the chart so you remember I have declared a variable with column one and column two now SD dot subheader let me write the sub header guys first of all so in the sub header I am saying this is the category y sales okay category by sales now I am taking a variable fig equal to plotly dot bar I am using and I'm here using my category data frame this one comma and here what is the x axis let's say my category and what is the y equal to let's say our sales if you want to format your you know data set format your data set means if you want to format your values so simple you can Define here the dollar sign okay and simple only two decimal point I want got it and here I can use the format X guys here I am using the list comprehension category dfn sales simple let me use the comma and after that let's say I am using the template C1 will provide lots of template so I am using the template is let's say c bond are now SD Dot plotly chart all right and now fig use container width equal to true so guys if you are going to set this true automatically if you are going to you know reduce the size of your window automatically your chart will be you know restructured so we are getting you know some exception let me check here so guys this particular apostrophe will come here now it is perfect right okay now the same thing let me do for the column two so again I need to write the subheader right so some header will be you know reason why sales all right reason why sales and here I want to use let's say you know uh pie chart for an example so fake equal to p x dot pie chart and here I want to use my filtered data frame and the values I want to choose the sales and the name is equal to reason and if I want to supply you know some whole equal to let's say 0.5 all right and now fig dot update dresses so let's say text equal to filtered again DS and I want reason or maybe you want to change guys some you know text position equal to let's say outside okay simple and now St and plotly chart and here the Fig and again the use container width right equal to true so guys now let me save this particular code and we'll see so you can see here we are getting the look at this now the beauty here let me reduce or guys once more okay and guys one more thing if you want to you know change the mob so guys so guys one more thing if you want to change the background color as well so simple you can go here and go to the setting and here I have a dark but if you want to add this dark theme you can also add it let's say I want I don't want to use the pure black color so one two three four five you can define the five times two and this e so look at this right so now you can see the changes okay so let's see if I am going to choose the state so look at this data automatically changing right now I am getting the information for South and which is hundred percent and again if I'm going for Central automatically your data will be reflected look at the duty again this no no sales uh let me apply two and three my God I think guys some issue here right so you can see so guys based on uh State my data is not reflecting okay so we have to check let's see what is the issues okay so the issue will be here so first of all if not reason equal and not State and not City then I want DF and into the filter data all right alif not a state and not City then I am going to filter the reason that's great if not reason and City then I am going to filter only the state apart from that the state and city okay so all right so simple state and here the city that's great and then I have reason in city so you can see here the reason I'm setting that I want filter DF and the reason and the City and then reason and state so I want okay so it has to be State guys the state now City for the city now let me see the changes were equal to is true all right now let me go with the east region and let me select the state still is not working it has to be reason so guys you can see here if I am going to choose the reason let's say best and based on that I can you know select particular category now I am going to add let's say another reason for an example Central and here I am going to choose you know not a city I want to choose again some state so you can choose the state as well right so now the live data is reflecting based on your filter simple okay now let's proceed further and guys now very interesting concept I am telling you let's say if you want to see or download the data based on these chart so are you understanding what I'm trying to say so let's say this these particular chart is created based on the live data if I am going to filter the reason let's say I have choose the best or maybe let's say East right now this particular chart is created based on West and East data set or maybe if I am going to filter you know some specific you know State as well so now you can say that hey this particular data is reflecting based on the these reason and these city state so if you want to check the live data just like a tableau and power bi okay so how we can see the actual data of these particular chart is created based on the filter okay so again let me go with the cl1 or you can say that column one and column two so column one and column two means this is the particular one column and this is the particular second call so here again column one and column two equal to St dot columns and I want two columns guys got it so first of all let me show you one important concept here cl1 so guys with and St dot expander okay so let's say category view data I want to view the data of category right so simple St and let's make St dot right and here category TF and guys if you want to you know Supply some style right so style kind of mechanism I have already explained in the last session so simple background gradient and here I am using cmap let's say Blues cut it and now if you want to download the data as well okay sometime if you are reading the chart or based on that let's say you want to download the data for a specific chart right so simple again to CSV and here I don't want index anymore in the data set so false and here guys I am going to encode my data in code in udf8 simple and now let me create another button so St dot download button so by which you can download the data so simple download data and the data equal to CSV and the file name should be category dot CSV simple and here the type will be text or CSV and here you can write you know some help in case you want so let's say click here to download the data as a CSV file simple got it now the same thing let me do for another reason wise data okay now with column two data will be data will be guys the reason okay so I'll go with the I have to change this information okay so how how I am getting the reason first of all can you tell me how I am getting the reason so I am getting the reason in different way so let's say reason equal to filtered DF okay from the filtered DF I am getting the reason let's say Group by and I am going to group the data based on the reason as index equal to false and I am going to perform the sales dot sum okay so the above line right which I have implemented for the chart you can see here right filter.df and the reason wise can you see this so guys now for this let me change the color let's say oranges and again here will come reason and the reason dot CSC simple okay so let me see this and we'll see the changes uh we are getting is not camp what is the camp case it should be cmap again here as well see map so it should be reason download button as a CSV okay now guys it's correct right so so good alignment was wrong so let me correct the alignment so guys now you can see here the category view data so it is very easy right so based on that whatever the data I am getting look at this the same data I am getting here and here the data I am showing in the percentage but here I am getting the values so let's see if you want to download this data okay so simple you can click on the download so here you will get the category.csv simple and similarly here also if you want to download this data so you will have the reason dot CSU okay so it is very easy now if you want to close this section so simple you can click here okay very interesting all right now one more thing now visualize the data using the time series analysis based on month year so what do you mean by so first of all let's say I am going to filter DF right and here I am going to add a brand new column in the data frame which is month and year and here filtered DF right whatever the order date I got or a date right so I know this is the date column and 2 period and here I want to extract month okay now what I am doing here again St Dot subheader and here Time series analysis guys this is a very long project not very long but this is the long project and very interesting and now uh I am going to create a line chart right so I want to create the line chart for the time series analysis so how we can do that so PD dot data frame okay if you will filter the DF right filtered DF and now Group by okay based on which column so again filter DDF column name is month year got it month year and this is dt.strf time and here I want to include ear colon and I want to include the month name simple based on that let's say what I want based on that I want to create a sales dot sum okay and guys let me reset the index as well so I have reset the index okay so I hope you guys are aware in the in the transformation of the data set with the help of pandas now figure two PX dot line chart or you can say that line then I want line chart simple x-axis let's say month and year and y equal to I want sales and labels equal to let's say the sales has to be amount right simple and here height equal to let's say 500 and the width equal to 1000 let me check what will happen and the template guys template I want grid on this is the template I want make sense all right okay so this is the chart let's say I have created now let me set this chart so set plotly chart and here again Fit 2 and the guys use container with equal to true simple okay now let me run this so guys you can see here I am getting the you know time series analysis right so you can see here year and month year and month and year okay very interesting and again if you want to give you know some icon here to download the real data based on this chart so again what you will do let me create this so or directly you can write here with x s t dot expander and here view data for off times series time series simple right and now guys SD dot right so all the data stored in the line chart I want to transpose this data let's say Style got it so guys look at this you can see the data okay so I hope you understood let's say why I have rotate this data so these are the indexes and now I have month in sales so you can see this all right very interesting and now if I will be click on the download right so look at this data will be downloaded or the time series dot csvs so you can see and you can open it as well look at this okay interesting now guys let me create a tree map based on reason category and subcategory okay so you can see I'm not using any fancytic only the pandas I am using so whatever the data I am getting in my variable that data I am going to plot or I am going to show in the expander or in the data frame or in the download button or in the column simple and now similarly I will do for the tree map also so first of all St Dot sub header I want to create so let's say equal view of sales using tree map got it and now again guys fake three you can use let's say px.3 map it is very easy to create entire data set or entire filter DF I am going to supply here and I'm using the path let's say what I want I want based on reason based on the category first of all reason will come then category will come and then subcategory will come you can change also based on your requirement in case you want and here the values should be my sales and you want to see the hover data as well right so whoever data not date he will over data equal to so guys sales and maybe you want to you know some colors colors based on sub category simple and now fake three which is update layout this one and here with equal to 800 and height equal to 650. okay guys and now St dot plotly chart and the information in fig tree and again use container with equal to true got it let me save this and let me see the changes look at this guys interesting and now again go to the setting dark and let me add it what was that number one two three four five and E all right so look at this how you can navigate so first of all reason will come then these categories will come okay and these are the information so again look at this all right so you can easily navigate in case you want okay all right interesting so we have done you know almost a lot of thing now let's create the segment wise and category by sales so again you can create a sensible name let's say chart one and chart two equal to St dot columns and here I want only the two columns and now what I'm doing here with chart one St dot subheader again and here segment y sales same thing let's say we have done ever right so fake equal to p x dot pie chart I want to create right now So based on the filtered EF and guys value equal to sales names equal to segment now let me change the template equal to let's say dark underscore dot right and fig dot update traces and here text equal to filtered I want based on the category and the text position equal to inside let's say and here is plotly chart use container with equal to true let's see the changes Furniture office supply okay by mistake it has to be segment right foreign simple and now guys now the same thing let me copy let me paste for the chart two and here I want category all right and here again category and here you can change the template in case you want let's say grid On and Here category let me see interesting so guys now you can see here this is the very interesting or very easy to develop the dashboard using the python plotly all right now how we can show some specific columns data into a table format using the streamlit some important column you can pick and those columns data I want to see in particular portion so how we can see that data okay so guys again so I need to import a plotly DOT figure Factory as FF okay and sd.sub header and again let's say guys here I am going to add a icon let's say point to the right side simple month wise sub category sales summary just just an example okay so with st dot expander and here summary table okay and what I will do so DF and Sample I am taking only the sample data guys I want to show so let's say only five rows let's say I want to show and out of five rows I want reason only the main column not hold the data City or only the top five row category and sales let's say profit or let's say Quantity only this data now fake equal to Now using this figure Factory I can create the tables create table so it is very easy to create the table so simple DF dot underscore sample and the color scale we can give here save this yeah and St dot plotly chart and here guys I can give you know the fake and again use container with equal to true easy let me run this so you can see here I am getting this right hand and month-wise subcategory sales okay so let me check the error guys so what is the error f grade table sample color scale I think C should be caps okay c i v i right now let me check this hey guys so it is working right so I can see the you know some sample data all right and similarly uh let me add one more thing here let's say SD dot markdown I am going to add guys and here I am saying month wise sub category table okay and here again filtered DF so you can easily play with this kind of information I am taking a month and from where let's say I am going to extract the month so filtered DF again from the order date although I have you know already store the month name but right now I am telling you the another approach and simple now let's say sub category year equal to PD Dot pivot table interesting concept I have already explained data equal to filter DF so guys if you are really interested uh to watch the pivot table so I will give you the link the values equal to sales and here the index equal to sub category and columns equal to let's say month okay or I can arrange this simple now SD dot write subcategory here dot Style and again background gradient C map equal to Blue it is not necessary but if you want to you know Supply some color so you can supply it month name so guys you can see right so look at this data so I have all the subcategories I have the month right so I can easily export this data from April to September right so now look at this all the data I can you know check if I am getting the you know highest value so that value is also highlighted so for you can see in the Fab month for this particular subcategory I don't have anything so I am getting this black color it's a none okay so this is very interesting and again if you will expand this it will be closed and if you want to expand again so you can see the data okay so in our particular area you can easily reflect your data but again if I am going for let's say any specific Central so the data you know accordingly change look at this the sales has been changed now I'm getting a lot of nuts now again for the East so this is the beauty of this particular you know application all right now uh two and three things are remaining so let's say if I want to create the scatter plot for showing the relationship between sales and profit so simple greater scatter plot so again guys data one I am taking here PX dot scatter and here filtered ETF I want I'm not going to filter right now here because we can take the filter data from the data pane y equal to profit PCP caps and the guys size based on the quantity and here data1 dot let me go with the let's say let me set the layout Dot update and here I'm giving the title let's say relationship between sales ad profits using the scatter plot simple so here different parameter will come for the scatter equal to dictionary and I want to supply let's say 20 and here x axis equal to again dictionary and again guys title equal to sales comma title font equal to again dictionary answer is equal to any sensible size let's say 1920 whatever you want you can give it comma and y axis equal to again dictionary and title equal to profit comma title font equal to dictionary and the size also 19. now I will check let's say why we are getting this and I think let me show us this all right now guys St dot plotly chart and data one and again use containers equal to True simple interesting got it okay and one more thing sometimes let's say if you want to download the entire data set of a specific portion as an interactive table so earlier let's say I was showing only the top five rows but right now I want to you know check the maybe hold the data set okay or maybe you know top 500 rows so how can how we can view so guys with St dot expander directly you can write here let's say view data and simple St dot right here the filtered DF although let's say I have 9994 rows in this data set so I am using ilock and I want first 500. and I want you know some random column from 1 to 20. and the step size is two so every second column I want and if I want to use style Dot background gradient background gradient see map equal to oranges okay so look at this hold the data you can navigate here hold the database okay so in a specific portion so right now let's say I am giving only the top 500 rows if you want to supply the entire data set so you can supply the entire data set as well okay and guys the last thing is in some cases someone want to download the original data set okay so how they can download the original data set so again CSV equal to DF to CSV I don't want index anymore and guys in code equal to UDF and 8. an st Dot download button and here download data and the data will be again in the form of CSV and the file name file underscore name equal to data.csv and again in the form of maybe text or CSV simple guys now I have view data now simple I have download data set as well data.csu all right so guys right now this is done so in approximately 160 line we have done this particular dashboard application and again now you can easily navigate if you want to browse so you can browse and you can upload the data set if you want okay so your data will be reflected so can you see here right now for the furniture right the sale is 741 triple nine so let me open the data set guys this is the data set for the furniture okay so uh this was the furniture I am going to set as a 262. and now I am going to save this data set save it now what I'm doing here so it will change right so this triple line will change so again go to the browse so if your data is keep adding or your data is changing every time so simple you can you know extract the live CSV and open it and look at this the number has been changed automatically all the information will change all the start date and and date will change and your region state and city will change in case the data is deleted or added look at this now you can you know close this and here you want to select any specific let's say south so guys this data only for the South and Central Region look at this again you want to download the data or you want to re get the data again only for the South and Central and you can see the chart and based on that let's say time series analysis and view data of Time series if you want to check and guys hit radical view so this is very interesting to navigate I am really enjoying this kind of you know navigating navigating the start and apart from that again segment my sales and category by sales based on your selection and again one price subcategory sales and summary interesting guys and here I am going to show the summary of Southern Central based on the month got it and look at this but sometime if you want to you know expand this data look at this can you see this once you click on here so the data will be expand okay again interesting and now the same thing here as well you can do that okay look at this so you can easily navigate the data all right if you want to download this data as well so you can give you know here the download option or this view data so this is very easy and if you want to download this data as a whole so you can easily download and again if you want to filter the data so you can easily filter the data okay and if you want to see the city Only and you can go to the city as well so accordingly your chart and your information will be changed let me remove this let me remove this and guys sometimes let's see if you are not choosing any kind of reason you are going with you know City only so you can choose the city right so your data will change automatically look at this Time series right iCal view we have you know interesting and guys in this session I am using the pandas and plotly thoroughly pandas for transforming the data and whatever the result I am getting from the pandas the data I am going to store in plotly chart okay uh using the streamlit simple and if I want to navigate the data so I can navigate I have made a proper combination of the filters then I have applied the reason why sales perform simple simple chart and store in the blockly chart if I want to create a two and three segment then now you can go with the columns 3 and you can you know parallely show the three chart right if you will close this so your chart automatically adjusted because we have used a used container with equal to true okay and if you will press f11 so your a particular dashboard will be on your full screen so you can easily navigate so guys this application you can host as well in case you want to apply you know some email kind of functionality as this particular dashboard should be sent on a specific recipient so you can add the email kind of stuff as well okay I will let you know in some other session and similarly let's say I have applied the you know some time series analysis it is very easy simple Group by the data and formatting the data based on year and month if you want to view the data so I have transposed the data and again guys this kind of stuff let's say I have applied for three map as well okay so the same thing but here you have to keep in mind when you are going to create the tree map so here the path reason category and subcategory I have included the segment by sales is easy and if you want to show some information okay for the you know the client perspective uh as a table so you can you know uh store your data in the form of tables so only then let's say top five rules I have uh stored as a table but if you want to store the data uh you know or the last data set so you can store definitely let's see you will not store the only the raw data maybe some inside kind of stuff you will be stored as a table so as we have done for the month name and month by sales so I have based on the subcategory or not right so I have done this I perform some relationship based on the scatter sales and profit and quantity and again you want to see the data or you want to download the data so guys I will share this particular script and I will share the data whatever I am using so please do the practice of this session and really in case you are facing some difficulty uh in order to understand any kind of topic you can let me know all right guys so guys that's all for this session and for now thanks for watching and have a great day [Music] thank you foreign [Music]
Info
Channel: Programming Is Fun
Views: 85,451
Rating: undefined out of 5
Keywords: Streamlit interactive plots, Uploading data into Streamlit dashboard, Streamlit titles and headings, Pandas data handling with Streamlit, Transforming data in Streamlit with Pandas, Visualizing data with Plotly in Streamlit, Time Series Analysis in Streamlit tutorial, Downloading data from Streamlit plots, Data Analysis and Visualization with Python Streamlit, Streamlit tutorial, Mastering Streamlit, Exploring Streamlit features, Step-by-step guide Python Dashboard, Streamlit date
Id: 7yAw1nPareM
Channel Id: undefined
Length: 66min 21sec (3981 seconds)
Published: Tue Jun 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.