This is just amazing, a real tutorial, no demo of useless stuff where you have to buy a 300$ course afterwards. Great example from start to finish, I can work from here on my own. Thank you very much sir.
You're very welcome! I'm glad to hear that you found the tutorial helpful. If you have any more questions or need further assistance with anything related to the topic or any other topic, please feel free to ask. I'm here to help.
This is the best video I've seen in 2023. Even better than Netflix and all that stuff. A true gem, I'll start to use this style of dashboarding for my job! Blessings man!
Thank you for your input. Indeed, when handling larger datasets, Streamlit performance may slow down. However, there are several strategies you can employ to optimize your Streamlit application and enhance its efficiency: Utilize Caching: Apply the @st.cache decorator to your data loading or processing functions to store the results and avoid redundant computations. import streamlit as st import pandas as pd @st.cache def load_data(): df = pd.read_csv("large_dataset.csv") # Any necessary data manipulation can be performed here return df df = load_data() Opt for Efficient Data Structures: Consider using more efficient data structures like Dask or Vaex, which are tailored to handle large datasets more effectively. Remove Unnecessary Columns from DataFrame: Trim down your DataFrame by removing any unnecessary columns, reducing memory usage and processing time. Async Support: Explore Streamlit's experimental async support for operations involving asynchronous tasks, preventing the application from blocking while waiting for these tasks to complete. By implementing these techniques, you can mitigate performance issues associated with handling larger datasets in your Streamlit dashboard.
Bhai maine nhi socha tha India mein itna mast coder milega. Main to fan hogya. I will watch all your videos. Let me know if you have any courses on any platform
Thankyou for such an incredible project. However, I am curious if there is a way I could add an interactive map to this data which shows the sales data points on the map. If yes, please help.
super interesting tutorial but I have an error that I don't understand: ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2
Hi sir, Firstly, that's a great explanation by you. I have a josn files stored in FIreBase database, how to get that that data in real time to build a dashboard like you did in real time?
Great tutorial I am little bit confused that how we can get time series data in correct order I mean month wise I think sort could work but still thinking would it be valid or not
Great Work. Much appreciated. Can we share the dashboard report with other users in our office and can we fetch data from 4 files which are stored on a sharepoint folder. Thanks in advance.
If you use a different dataset, the functionality may not be optimal as the system is tailored specifically for the superstore sales data. Similarly, in real-life scenarios, creating a dashboard using PowerBI and Excel is effective, but if the underlying data is changed to a different dataset, the dashboard will no longer function correctly.
This is absolutely amazing!!!. But, while implementing i got an error called AXIOS ERROR - 403 as status code in file uploader function. I want you to help me from that, i would really appreciate your efforts, thank you.
Hello I find this tutotial more relavant and intresting , however , I am unable to understand where the data is getting stored , i guess in the server memory , if need the data to come from Excel files e.g. one file for each month how do i merge these twelve files or do i have to merge it manually , what if the data needs to be used from a SQL DB how can the same being achieved , I am not sure of the performance impact e.g. if each csav file has got 1lacs plus rows etc.
Hello Sandeep, I'm pleased to hear that the information is proving beneficial for you. In this tutorial, we retrieve data into a Pandas DataFrame, where the DataFrame functions as a storage unit for information sourced from an Excel file. For instance, if you receive a file every month, you can utilize Python programming to consolidate this data. This implies that upon saving a file to a designated directory, the data merging process will execute automatically upon running the designated application or tool. Likewise, if you opt to store the data within an SQL database, Python can be employed to seamlessly import the data into the database without manual intervention. To enhance your comprehension, I am providing you with 2-3 instructional videos that will be of significant assistance. 1.) Combining Excel Sheets or File: th-cam.com/video/hTLmfqSQ-hA/w-d-xo.htmlsi=nponR3dGS6N1cQtH 2.) Python Pandas Tutorial: Importing Bulk CSVs Data Into SQL Server Using Python: th-cam.com/video/eEVG-A4R9WU/w-d-xo.htmlsi=1czJrortLN3Wexl6 3.) Auto Export Data from SQL Server with Notification: th-cam.com/video/8BiQx_xEIhw/w-d-xo.htmlsi=xbzyhWA-v2T7AdMr
Super interesting tutorial but I have an error that I don't understand: StreamlitAPIException: ("Expected bytes, got a 'float' object", 'Conversion failed for column 0 with type object') Traceback: File "pages\graph.py", line 114, in st.write(linechart.T.style.background_gradient(cmap="Blues")) Thanks
I have got the same error . So i searched a bit and found out it was an encoding error of utf-8 . Eventhough I wasnt able to avoid it ; but I coverted csv without encoding and its working with warning .Here is the updated code ; let me know if it works for you df_filtered['month_year'] = df_filtered['Order Date'].dt.to_period('M') st.subheader('Time Series Analysis') linechart = pd.DataFrame(df_filtered.groupby(df_filtered['month_year'].dt.strftime("%Y:%b"))["Sales"].sum()).reset_index() # Optionally convert to CSV without encoding csv = linechart.to_csv(index=False) fig2 = px.line(linechart, x="month_year", y='Sales', labels={"Sales": "Amount"}, height=500, width=1000, template="gridon") fig2.update_layout(title="Time Series Analysis") st.plotly_chart(fig2, use_container_width=True) with st.expander("View data for Time Series"): st.write(linechart.T.style.background_gradient(cmap="Blues")) st.download_button('Download Data', data=csv, file_name="Timeseries.csv", mime="text/csv")
hi, i find this tutorial really amazing, but I am getting an error while uploading new excel documents and the error is df["Order Date"] = pd.to_datetime(df["Order Date"]) how can i fix it
Hey Aman, we have done couple of project projects on streamlit. And You can also refer another tutorial let me share with you. th-cam.com/video/rviQtjkxQQY/w-d-xo.htmlsi=BVwq49cpmUr3k5LI th-cam.com/video/6Eu2b34alsE/w-d-xo.htmlsi=IrQfgwKJEjrBqP4z
Hi, thank you for the tutorial. I have question : elif state and city: filtered_df = df3[df["State"].isin(state) & df3["City"].isin(city)] elif region and city: filtered_df = df3[df["Region"].isin(region) & df3["City"].isin(city)] elif region and state: filtered_df = df3[df["Region"].isin(region) & df3["State"].isin(state)] for this part of code. Why did you put df inside df3 isin state/region? thanks
Hello, when you use the code df["State"].isin(state), it will generate a series of True and False values based on whether each element in the "State" column matches any element in the provided state list. For instance, if your "State" column contains values like NewYork, Florida, Ohio, NewYork, Florida, and you execute df["State"].isin("NewYork"), the result will be True, False, True, False, False. To filter rows containing only "NewYork," you should use df[df["State"].isin("NewYork")]. For a more detailed explanation, you can refer to this tutorial: th-cam.com/video/j4T6OwimfFY/w-d-xo.htmlsi=mDvMlFAU2MasEnvX. Thanks and keep watching.
@@ProgrammingIsFunn I understand what it used for. But why : df3[df["State"].isin(state) & df3["City"].isin(city)] Its df inside df3? isnt it supposed to be the same dataframe inside the dataframe example : df[df['State'].isin(state)] or df3[df3['State'].isin(state)]
@@ProgrammingIsFunn df[df['State'].isin(state)] or df3[df3['State'].isin(state)] not df["State"].isin(state) chatgpt said you were typo. I think you are. It supposed to be same dataframe instead different dataframe
Thanks for your comment. My channel may not be as well-known as others, so I truly value your support. Please consider sharing these helpful videos with your peers, colleagues, and friends. Feel free to let me know what topics you're interested in for future content, so I can plan accordingly.
Hello, thank you so much for your video. I have tried to apply for my dataset, and I have had some issues (ImportError: Pandas requires version '3.0.0' or newer of 'jinja2' (version '2.11.3' currently installed).) when running this code: st.write(gen_table.style.background_gradient(cmap="Blues")). Could you please help me to solve it? Thank you!
@@ProgrammingIsFunn Thank you! And I also have another issue in that code is: "AttributeError: module 'matplotlib' has no attribute 'colormaps'". Could you help me with this?
If i have multiple pages and I want to select start date and end date in 1st page and it should filter for other pages also , How can i achieve that functionalities
Thanks for the query. You can store start date and end date in a variable and when you are rendering any page of streamlit. # streamlit_app.py import streamlit as st from datetime import datetime # Initialize session state for start_date and end_date if not already done if 'start_date' not in st.session_state: st.session_state.start_date = datetime.now() if 'end_date' not in st.session_state: st.session_state.end_date = datetime.now() # Define the first page def page1(): st.title("Page 1: Select Dates") start_date = st.date_input("Start Date", value=st.session_state.start_date) end_date = st.date_input("End Date", value=st.session_state.end_date) if start_date > end_date: st.error("Start date must be before end date") else: st.session_state.start_date = start_date st.session_state.end_date = end_date st.write(f"Selected Start Date: {st.session_state.start_date}") st.write(f"Selected End Date: {st.session_state.end_date}") # Define the second page def page2(): st.title("Page 2: Filtered Data") st.write(f"Using Start Date: {st.session_state.start_date}") st.write(f"Using End Date: {st.session_state.end_date}") # Example of filtering data (you can replace this with actual data filtering) data = [ {"date": "2023-01-01", "value": 10}, {"date": "2023-02-01", "value": 20}, {"date": "2023-03-01", "value": 30}, ] filtered_data = [d for d in data if st.session_state.start_date
@@ProgrammingIsFunn Not nested filter , means when we click on pie chart , other graph should automatically filter Just like we do normal click in powerbi. Thank you !
Very imformative. However, I am getting this error : StreamlitAPIException: ("Expected bytes, got a 'float' object", 'Conversion failed for column 0 with type object') Traceback: File "second.py", line 112, in st.write(linechart.T.style.background_gradient(cmap="Blues"))
please listen once , very informative video , Bhaiya i want to upload any sales data in browse file and it will give the anaylisis like you shown in this video . how can i do this with any sales data set. it return error if i upload any other sales dataset. what can i do ,please help me ,this is my project.
For any other sales data it will not work, because I have used the column name into the script. However, you want to upload your own data set then you need to customise your dataset based to columns accordingly.
It's completely up to you. If you wish to refresh this dashboard automatically whenever your data is updated, Streamlit offers an option to always rerun when your data source changes. This is particularly useful when you're connected to the cloud, as any changes in the data source will automatically reflect in the dashboard.
Once it is redirected on Tableau community, so scroll down little bit then you will see the icon of excel file link and download it. If you are not able to find it then from below link you can download the order.xlsx file. github.com/AbhisheakSaraswat/RawData/blob/main/Order.xlsx
this line giving error (20line ) df = pd.read_csv("Superstore.xlsx", encoding = "ISO-8859-1") ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2 (fix it proper iso ) reply asap
@@antukhan5592i've got the same issue. First download above `xls` file. Then export it to `csv` (you need only first table), rename it to Superstore.csv. Then modify line to 'df = pd.read_csv("Superstore.csv", sep=";", encoding="UTF-8")'. Now it works for me.
my "pip install streamlit" does not work. how do I need to do? I have python extension. Do we need conda env in vs code or anything? I have invalid character error. thanks
can you tell me what error you are getting? If PIP is not recognized then you have install the pip in your system. from below path you can save on your desktop. (just open the below link and press Ctrl S) bootstrap.pypa.io/get-pip.py once is done, then open your cmd and redirect to the desktop and write the below command: python get-pip.py Thanks!!!
ImportError: background_gradient requires matplotlib. st.write(category_df.style.background_gradient(cmap="Blues")) getting this error here..... how to solve it ??
@@ProgrammingIsFunn File "D:\chatbot\myvenv\Lib\site-packages\streamlit untime\scriptrunner\script_runner.py", line 552, in _run_script exec(code, module.__dict__) File "D:\chatbot\app.py", line 23, in df = pd.read_csv("Superstore.csv",sep='\t',encoding='ISO-8859-1',error_bad_lines=False)
@@ProgrammingIsFunn df = pd.read_csv("Superstore.csv",sep='\t',encoding='ISO-8859-1',error_bad_lines=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: read_csv() got an unexpected keyword argument 'error_bad_lines' please tell how to solve this error
Thanks. Please follow this link and download the excel file. community.tableau.com/s/question/0D54T00000CWeX8SAL/sample-superstore-sales-excelxls Just scroll little bit then you will able to see excel icon with download button
@@ProgrammingIsFunn No idea , i was just ran the code , upto region and got this error and after finding from internet it looks like File is not okay , So i find another dataset and put order date in that file , But now i am getting error as Order Date is Keyerror
Thank you for your video. Please could you help me with the following question. After I import a .csv with only two decimals like 1.00 or 333.00, the following lines don't maintain those two decimal. Those decimals become 1.000000 or 333.000000. I would like to have only two decimal. Could you help!? with st.expander("Table"): st.write(category_df.style.background_gradient(cmap="Blues")) csv = category_df.to_csv(index=False).encode('utf-8') st.download_button("Download", data=csv, file_name="file.csv", mime="text/csv", help='Click here to download') with st.expander("Table"): df_selection["month"] = df_selection["date"].dt.month_name() sub_category_Year = pd.pivot_table(data=df_selection, values="amount", index=["name"], columns="month") st.write(sub_category_Year.style.background_gradient(cmap="Blues")) with st.expander("filtered"): st.write(df_selection.iloc[:500, 0:20:1].style.background_gradient(cmap="Blues_r"))
@@ProgrammingIsFunn Thanks for the response but the problem is in the expanded tables in Streamlit like you can see in your video at time 37:42. The expanded table shows 6 decimals. Do you think you can help me?
@@Nick-qw3lm st.write(df.style.format("{:.0f}").background_gradient(cmap='Blues_r')). This should help you. You can change the '0f' to '2f' if you want two decimals
Wow amazing video, Subscribed ..... 🙂 I'm loving Python and especially the visual libraries. Do you do private tutoring through Skype by any chance? If so please let me know and I'll give you my email to discuss rates? thank you :-)
The code snippet you provided, however, does not include any calls to the append method. To handle the issue, consider the following Library Versions: can you check library versions whatever your are using? If you're still facing issues after verifying these aspects, please provide more context (In which line you are getting an error or you are writing the same code as in video) or the relevant parts of your code so that I can help you further.
@@ProgrammingIsFunn I figured out the issue, thank you! You were correct though; I had to update my libraries to solve the issue. I was confused though because I never had the append method anywhere in my code, so I am not sure why the error was mentioning that.
Hi, This is very amazing and appreciate you sharing this . Also, I have an insurance brokerage firm and wish to leverage this in our organisation. Can you please send me your direct contact details so we have a discussion around you building something similar to this offline for a fee?
This is just amazing, a real tutorial, no demo of useless stuff where you have to buy a 300$ course afterwards. Great example from start to finish, I can work from here on my own. Thank you very much sir.
You're very welcome! I'm glad to hear that you found the tutorial helpful. If you have any more questions or need further assistance with anything related to the topic or any other topic, please feel free to ask. I'm here to help.
This is the best video I've seen in 2023. Even better than Netflix and all that stuff. A true gem, I'll start to use this style of dashboarding for my job! Blessings man!
Awesome!!! I'm glad to hear that you found the tutorial helpful.
This works but i have dataframe with 1lac rows and everytime I click something it goes on in loop and slows down
Thank you for your input. Indeed, when handling larger datasets, Streamlit performance may slow down. However, there are several strategies you can employ to optimize your Streamlit application and enhance its efficiency:
Utilize Caching: Apply the @st.cache decorator to your data loading or processing functions to store the results and avoid redundant computations.
import streamlit as st
import pandas as pd
@st.cache
def load_data():
df = pd.read_csv("large_dataset.csv")
# Any necessary data manipulation can be performed here
return df
df = load_data()
Opt for Efficient Data Structures: Consider using more efficient data structures like Dask or Vaex, which are tailored to handle large datasets more effectively.
Remove Unnecessary Columns from DataFrame: Trim down your DataFrame by removing any unnecessary columns, reducing memory usage and processing time.
Async Support: Explore Streamlit's experimental async support for operations involving asynchronous tasks, preventing the application from blocking while waiting for these tasks to complete.
By implementing these techniques, you can mitigate performance issues associated with handling larger datasets in your Streamlit dashboard.
Bhai maine nhi socha tha India mein itna mast coder milega. Main to fan hogya. I will watch all your videos. Let me know if you have any courses on any platform
Thank you so much, your video was very very useful for me, you save me! Greetings from Colombia
I am glad this video is beneficial for you. Keep watching
Fantastic video! What you have taught can be used directly into a project. Thanks!
Yes you can use it and then you can try to deploy on your production environment if needed.
Amazing tutorial giving a great insight into the use of Streamlit. Thank you!
Thanks Lee. I am glad it works for you
I am really impressed and motivated after watching this video
Thanks for the stunning visualisation
Thanks for the appreciation☺️
Incredible Share Sir! Wonderfully Explained!! Awesome Visualizations. Thanks for this informative detailed explanation!
Best tutorial on the topic EVERRR
This is one of the useful and informative video for every developer. Awesome
Really Amazing project for streamlit
I'm glad to hear that you found the tutorial helpful.
This was amazing. Thank you
Amazing tutorial video, thanks for sharing
hey, maybe you could do a version of this for investments growth portifolio? huge thanks man, loved the video!
It's very informative and very creative, you are bestest sir❤
Thank you Sir, very interesting!
Great! Really amazing tutorial! Thanks alot
Great learning video. Eye opener video.
Thankyou for such an incredible project. However, I am curious if there is a way I could add an interactive map to this data which shows the sales data points on the map. If yes, please help.
Just look at documentation of these libs.
Very useful video! thank you for sharing it.
Thanks for your comment. Keep Learning!!!
Are you support in small project development as freelancer or may be provide coaching?
Freelancing sometime
@@ProgrammingIsFunncan you please share your contact detail
Awesome video!!! Great learning
Great tutorial! thank you for sharing such a great knowledge
Glad to hear!!!
Interesting.. Thanks for sharing.😊
super interesting tutorial but I have an error that I don't understand: ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2
It's because in your data file, in line 7 there are 2 values. It's supposed to be one.
great video thank you for sharing
great video! how do you host it?
Awesome sir can u teach me for class i love ur video
fantastic job, great learning
Hi sir,
Firstly, that's a great explanation by you. I have a josn files stored in FIreBase database, how to get that that data in real time to build a dashboard like you did in real time?
Great tutorial I am little bit confused that how we can get time series data in correct order I mean month wise I think sort could work but still thinking would it be valid or not
Found the solution by myself again great tutorial worth every second
We can use the calendar module to get the month and based on that we can align our month
Streamlit store (in its servers) or has access to the data we use to create such dashboard?
You can deploy on your server as well
Great Work. Much appreciated. Can we share the dashboard report with other users in our office and can we fetch data from 4 files which are stored on a sharepoint folder. Thanks in advance.
Yes you can.
thank you so much for this!
You're so welcome!😉
Hi- my time series is not sorted with month and year, any guess where I might be going wrong.
You can do using additional column. More specifically extract the month number from the date and sort it.
this line: text = ['${:,.2f}'.format(x) for x in category_df["Sales"]], have an error, the column "Sales" is not numeric, is object, how can I fixed?
You have to convert sale column into numeric data type.
You can use pd.to_numeric function to convert the same.
thank you , but what if i want to use another dataset and choose it from the interface
i another words i want to make it dynamic dashboard
If you use a different dataset, the functionality may not be optimal as the system is tailored specifically for the superstore sales data. Similarly, in real-life scenarios, creating a dashboard using PowerBI and Excel is effective, but if the underlying data is changed to a different dataset, the dashboard will no longer function correctly.
Thank you very much
I'm glad to hear that you found the tutorial helpful.
This is absolutely amazing!!!. But, while implementing i got an error called AXIOS ERROR - 403 as status code in file uploader function. I want you to help me from that, i would really appreciate your efforts, thank you.
thanks for your video
I'm glad to hear that you found the tutorial helpful.
Hello I find this tutotial more relavant and intresting , however , I am unable to understand where the data is getting stored , i guess in the server memory , if need the data to come from Excel files e.g. one file for each month how do i merge these twelve files or do i have to merge it manually , what if the data needs to be used from a SQL DB how can the same being achieved , I am not sure of the performance impact e.g. if each csav file has got 1lacs plus rows etc.
Hello Sandeep, I'm pleased to hear that the information is proving beneficial for you.
In this tutorial, we retrieve data into a Pandas DataFrame, where the DataFrame functions as a storage unit for information sourced from an Excel file. For instance, if you receive a file every month, you can utilize Python programming to consolidate this data. This implies that upon saving a file to a designated directory, the data merging process will execute automatically upon running the designated application or tool. Likewise, if you opt to store the data within an SQL database, Python can be employed to seamlessly import the data into the database without manual intervention. To enhance your comprehension, I am providing you with 2-3 instructional videos that will be of significant assistance.
1.) Combining Excel Sheets or File: th-cam.com/video/hTLmfqSQ-hA/w-d-xo.htmlsi=nponR3dGS6N1cQtH
2.) Python Pandas Tutorial: Importing Bulk CSVs Data Into SQL Server Using Python: th-cam.com/video/eEVG-A4R9WU/w-d-xo.htmlsi=1czJrortLN3Wexl6
3.) Auto Export Data from SQL Server with Notification: th-cam.com/video/8BiQx_xEIhw/w-d-xo.htmlsi=xbzyhWA-v2T7AdMr
@@ProgrammingIsFunn you are the best!, Seriously🥰
very useful! Subscribed
Awesome 👏
Super interesting tutorial but I have an error that I don't understand:
StreamlitAPIException: ("Expected bytes, got a 'float' object", 'Conversion failed for column 0 with type object')
Traceback:
File "pages\graph.py", line 114, in
st.write(linechart.T.style.background_gradient(cmap="Blues"))
Thanks
I have got the same error . So i searched a bit and found out it was an encoding error of utf-8 . Eventhough I wasnt able to avoid it ; but I coverted csv without encoding and its working with warning .Here is the updated code ; let me know if it works for you
df_filtered['month_year'] = df_filtered['Order Date'].dt.to_period('M')
st.subheader('Time Series Analysis')
linechart = pd.DataFrame(df_filtered.groupby(df_filtered['month_year'].dt.strftime("%Y:%b"))["Sales"].sum()).reset_index()
# Optionally convert to CSV without encoding
csv = linechart.to_csv(index=False)
fig2 = px.line(linechart, x="month_year", y='Sales', labels={"Sales": "Amount"}, height=500, width=1000, template="gridon")
fig2.update_layout(title="Time Series Analysis")
st.plotly_chart(fig2, use_container_width=True)
with st.expander("View data for Time Series"):
st.write(linechart.T.style.background_gradient(cmap="Blues"))
st.download_button('Download Data', data=csv, file_name="Timeseries.csv", mime="text/csv")
Thank you so much for this. Can this be deployed on a server
Yeah we can. 👌
hi, i find this tutorial really amazing, but I am getting an error while uploading new excel documents and the error is
df["Order Date"] = pd.to_datetime(df["Order Date"])
how can i fix it
May I know about the error?
error on "Order Date" - raise KeyError(key) from err @@ProgrammingIsFunn
Hello, can someone help me i am using pie chart for showing the data, its not giving me any error but its displaying any chart as well
Can you share your code or approach if you can?
How to get rid of produced with plotly.js button?
can you tell us from where you are learning the streamlit other than document
Hey Aman, we have done couple of project projects on streamlit. And You can also refer another tutorial let me share with you.
th-cam.com/video/rviQtjkxQQY/w-d-xo.htmlsi=BVwq49cpmUr3k5LI
th-cam.com/video/6Eu2b34alsE/w-d-xo.htmlsi=IrQfgwKJEjrBqP4z
Hi, thank you for the tutorial.
I have question :
elif state and city:
filtered_df = df3[df["State"].isin(state) & df3["City"].isin(city)]
elif region and city:
filtered_df = df3[df["Region"].isin(region) & df3["City"].isin(city)]
elif region and state:
filtered_df = df3[df["Region"].isin(region) & df3["State"].isin(state)]
for this part of code. Why did you put df inside df3 isin state/region?
thanks
Hello, when you use the code df["State"].isin(state), it will generate a series of True and False values based on whether each element in the "State" column matches any element in the provided state list.
For instance, if your "State" column contains values like NewYork, Florida, Ohio, NewYork, Florida, and you execute df["State"].isin("NewYork"), the result will be True, False, True, False, False.
To filter rows containing only "NewYork," you should use df[df["State"].isin("NewYork")]. For a more detailed explanation, you can refer to this tutorial: th-cam.com/video/j4T6OwimfFY/w-d-xo.htmlsi=mDvMlFAU2MasEnvX.
Thanks and keep watching.
@@ProgrammingIsFunn I understand what it used for. But why :
df3[df["State"].isin(state) & df3["City"].isin(city)]
Its df inside df3? isnt it supposed to be the same dataframe inside the dataframe example : df[df['State'].isin(state)] or df3[df3['State'].isin(state)]
@@ProgrammingIsFunn df[df['State'].isin(state)] or df3[df3['State'].isin(state)]
not
df["State"].isin(state)
chatgpt said you were typo. I think you are. It supposed to be same dataframe instead different dataframe
The important thing is to integrated it with a good framework such Django! Is it possible? Many thanks.
Yes it is possible to do that.....
sir how do we deploy the web application which was made
Sure, we will let you know soon.
you have only 15k subs and this video having 163k views on 6/6/2024. That is amazing.
Thanks for your comment.
My channel may not be as well-known as others, so I truly value your support. Please consider sharing these helpful videos with your peers, colleagues, and friends. Feel free to let me know what topics you're interested in for future content, so I can plan accordingly.
Hello, thank you so much for your video. I have tried to apply for my dataset, and I have had some issues (ImportError: Pandas requires version '3.0.0' or newer of 'jinja2' (version '2.11.3' currently installed).) when running this code: st.write(gen_table.style.background_gradient(cmap="Blues")). Could you please help me to solve it? Thank you!
Thanks for the comment, you have to upgrade your pandas and jinja2
@@ProgrammingIsFunn Thank you! And I also have another issue in that code is: "AttributeError: module 'matplotlib' has no attribute 'colormaps'". Could you help me with this?
If i have multiple pages and I want to select start date and end date in 1st page and it should filter for other pages also , How can i achieve that functionalities
Thanks for the query. You can store start date and end date in a variable and when you are rendering any page of streamlit.
# streamlit_app.py
import streamlit as st
from datetime import datetime
# Initialize session state for start_date and end_date if not already done
if 'start_date' not in st.session_state:
st.session_state.start_date = datetime.now()
if 'end_date' not in st.session_state:
st.session_state.end_date = datetime.now()
# Define the first page
def page1():
st.title("Page 1: Select Dates")
start_date = st.date_input("Start Date", value=st.session_state.start_date)
end_date = st.date_input("End Date", value=st.session_state.end_date)
if start_date > end_date:
st.error("Start date must be before end date")
else:
st.session_state.start_date = start_date
st.session_state.end_date = end_date
st.write(f"Selected Start Date: {st.session_state.start_date}")
st.write(f"Selected End Date: {st.session_state.end_date}")
# Define the second page
def page2():
st.title("Page 2: Filtered Data")
st.write(f"Using Start Date: {st.session_state.start_date}")
st.write(f"Using End Date: {st.session_state.end_date}")
# Example of filtering data (you can replace this with actual data filtering)
data = [
{"date": "2023-01-01", "value": 10},
{"date": "2023-02-01", "value": 20},
{"date": "2023-03-01", "value": 30},
]
filtered_data = [d for d in data if st.session_state.start_date
@@ProgrammingIsFunn Thank you so much for this code , i will go through this , (^_^)
very interesting session..Please share how we can send mail also..
Yes, sure
in this video are you also teaching cross filtering , please reply
Yes here we are using nested filters
@@ProgrammingIsFunn Not nested filter , means when we click on pie chart , other graph should automatically filter
Just like we do normal click in powerbi.
Thank you !
why we can not apply to city what we did for the State ? In Min 21
We are choosing the state and corresponding their cities
Very imformative. However, I am getting this error : StreamlitAPIException: ("Expected bytes, got a 'float' object", 'Conversion failed for column 0 with type object')
Traceback:
File "second.py", line 112, in
st.write(linechart.T.style.background_gradient(cmap="Blues"))
Can you check the data type by which you are making line chart, means whatever the code you are using to create a variable like linechart.
please listen once ,
very informative video , Bhaiya i want to upload any sales data in browse file and it will give the anaylisis like you shown in this video . how can i do this with any sales data set. it return error if i upload any other sales dataset. what can i do ,please help me ,this is my project.
For any other sales data it will not work, because I have used the column name into the script. However, you want to upload your own data set then you need to customise your dataset based to columns accordingly.
how to put the project into production, where to deploy
If anyone could answer, is the dashboard always running or is it reliant on execution within python?
It's completely up to you. If you wish to refresh this dashboard automatically whenever your data is updated, Streamlit offers an option to always rerun when your data source changes. This is particularly useful when you're connected to the cloud, as any changes in the data source will automatically reflect in the dashboard.
Where do I get exel file, or raw data, link you provided, it has no xlsx file to download, it is redirected to some tableau community page, plz help
Once it is redirected on Tableau community, so scroll down little bit then you will see the icon of excel file link and download it.
If you are not able to find it then from below link you can download the order.xlsx file.
github.com/AbhisheakSaraswat/RawData/blob/main/Order.xlsx
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte.
You can use encoding while you are reading the file, example : pd.read_csv(filePath, encoding = “ISO-8859-1”)
My challenges is that the filter is just showing only one item selection.
I have solved the problem by ignoring the datetime filter. The problem occurred might be due to the different dataset used
can this be replicated but with jupyter notebook?
Yes we can
can we did in Pycharm
Yes we can !!!
Stuck at this error : - "AttributeError: module 'matplotlib' has no attribute 'colormaps'" , it would be great if I get some help
Share the code which you wrote
I was trying the same code that you've shared
this line giving error (20line ) df = pd.read_csv("Superstore.xlsx", encoding = "ISO-8859-1") ParserError: Error tokenizing data. C error: Expected 1 fields in line 7, saw 2 (fix it proper iso ) reply asap
You have put the wrong function to read excel file, it should be read excel without encoding parameter
pd.read_excel(“superstore.xlsx”)
@@ProgrammingIsFunn doesnot work
@@antukhan5592 can you tell me what is not working?
@@antukhan5592i've got the same issue. First download above `xls` file. Then export it to `csv` (you need only first table), rename it to Superstore.csv. Then modify line to 'df = pd.read_csv("Superstore.csv", sep=";", encoding="UTF-8")'. Now it works for me.
@@antukhan5592 I had to use this line: df = pd.read_excel("Superstore.xls") and run this line in terminal: "pip install xlrd>=2.0.1"
my "pip install streamlit" does not work. how do I need to do? I have python extension. Do we need conda env in vs code or anything? I have invalid character error. thanks
can you tell me what error you are getting? If PIP is not recognized then you have install the pip in your system.
from below path you can save on your desktop. (just open the below link and press Ctrl S)
bootstrap.pypa.io/get-pip.py
once is done, then open your cmd and redirect to the desktop and write the below command:
python get-pip.py
Thanks!!!
@@ProgrammingIsFunn I got below error. I think it does not accept pip: ModuleNotFoundError: No module named 'altair.vegalite.v4'
ImportError: background_gradient requires matplotlib.
st.write(category_df.style.background_gradient(cmap="Blues"))
getting this error here..... how to solve it ??
Can you try with import Matplotlib library
i have the same error what should i do i imported matplotlib
@@ProgrammingIsFunn
do tutorials of streamlit sir from scratch
is this a project or a tutorial ?
Hello iam getting an error at starting stage to read csv files and upload files please solve my error man
Can you let me know what is the error ?
@@ProgrammingIsFunn
File "D:\chatbot\myvenv\Lib\site-packages\streamlit
untime\scriptrunner\script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "D:\chatbot\app.py", line 23, in
df = pd.read_csv("Superstore.csv",sep='\t',encoding='ISO-8859-1',error_bad_lines=False)
@@ProgrammingIsFunn
df = pd.read_csv("Superstore.csv",sep='\t',encoding='ISO-8859-1',error_bad_lines=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: read_csv() got an unexpected keyword argument 'error_bad_lines'
please tell how to solve this error
@@user-qr6rk8zw5e Remove error_bad_lines keyword from the read_csv function
@@ProgrammingIsFunn its not working
great job seourisly bro ... i can't find the dataset
Thanks.
Please follow this link and download the excel file.
community.tableau.com/s/question/0D54T00000CWeX8SAL/sample-superstore-sales-excelxls
Just scroll little bit then you will able to see excel icon with download button
@@ProgrammingIsFunn thanks
getting this error
Error tokenizing data. C error: Expected 1 fields in line 7, saw 2
Can you tell in which statement you are facing an error
@@ProgrammingIsFunn No idea , i was just ran the code , upto region and got this error and after finding from internet it looks like File is not okay , So i find another dataset and put order date in that file , But now i am getting error as Order Date is Keyerror
@@ProgrammingIsFunn error solved , thanks
@@amanahmed6057 can you tell me what is exact error of code. or you are getting an error when you are reading the file.
Make more sample like db connection
Thanks for the comment
Thank you for your video. Please could you help me with the following question. After I import a .csv with only two decimals like 1.00 or 333.00, the following lines don't maintain those two decimal. Those decimals become 1.000000 or 333.000000. I would like to have only two decimal. Could you help!?
with st.expander("Table"):
st.write(category_df.style.background_gradient(cmap="Blues"))
csv = category_df.to_csv(index=False).encode('utf-8')
st.download_button("Download", data=csv, file_name="file.csv", mime="text/csv",
help='Click here to download')
with st.expander("Table"):
df_selection["month"] = df_selection["date"].dt.month_name()
sub_category_Year = pd.pivot_table(data=df_selection, values="amount", index=["name"], columns="month")
st.write(sub_category_Year.style.background_gradient(cmap="Blues"))
with st.expander("filtered"):
st.write(df_selection.iloc[:500, 0:20:1].style.background_gradient(cmap="Blues_r"))
Thanks for your comment.
You can try with below line 👇 :
category_df = category_df.round(2)
Then try to export the data into csv.
Good luck 🤞
@@ProgrammingIsFunn Thanks for the response but the problem is in the expanded tables in Streamlit like you can see in your video at time 37:42. The expanded table shows 6 decimals. Do you think you can help me?
@@Nick-qw3lm st.write(df.style.format("{:.0f}").background_gradient(cmap='Blues_r')). This should help you. You can change the '0f' to '2f' if you want two decimals
Wow amazing video, Subscribed ..... 🙂 I'm loving Python and especially the visual libraries. Do you do private tutoring through Skype by any chance? If so please let me know and I'll give you my email to discuss rates? thank you :-)
do you have any hindi channel ?
Getting this error:
AttributeError: 'DataFrame' object has no attribute 'append'
fig3 = px.treemap(filtered_df, path = ["Region","Category","Sub-Category"], values = "Sales",hover_data = ["Sales"],
color = "Sub-Category")
The code snippet you provided, however, does not include any calls to the append method.
To handle the issue, consider the following
Library Versions: can you check library versions whatever your are using?
If you're still facing issues after verifying these aspects, please provide more context (In which line you are getting an error or you are writing the same code as in video) or the relevant parts of your code so that I can help you further.
@@ProgrammingIsFunn I figured out the issue, thank you! You were correct though; I had to update my libraries to solve the issue. I was confused though because I never had the append method anywhere in my code, so I am not sure why the error was mentioning that.
@@johndong4754 Awesome, Keep Learning ...
Hi,
This is very amazing and appreciate you sharing this . Also, I have an insurance brokerage firm and wish to leverage this in our organisation. Can you please send me your direct contact details so we have a discussion around you building something similar to this offline for a fee?
...
How to connect it with google sheets?
you rock!... thanks!