Data table from selected Month Selector out of 365 daily dataset

Dear Community,

Trust all are well!!

Seeking your help again!!

I have a dataset which looks like this:


Its a time series data of 365 days a year. Now, I’m deploying a streamlit app which able to allow user to select a month from Jan to December using a st.selectbox option and based on the selected month, the app will show the daily dataset for that prticular month only. For example, If the user is selcting “July” as month, then data from 1st July to 31st July will be shown in a Datatable.

Please help me with the code

Thanks & Regards,
Amrit Mandal

Hi @amrit ,

Possibly this snipet can be useful for you.

# Modules
import streamlit as st
import pandas as pd
import datetime

# Read dataset
df = pd.read_excel('Book1.xlsx') # Test dataset in my case
# Choice of months
month_name = ["January","February","March","April"] # Add aditional months
month_choice = st.selectbox(label = "Select your month", options = month_name) # Give user to select

# Convert month name to value
df['month'] = pd.DatetimeIndex(df['date']).month
month_obj = datetime.datetime.strptime(month_choice, "%B")
sel = month_obj.month # Get the month value

# Get that particular month and display to the user
par = df[df["month"] == sel]
st.write(par["date"]) # You can add the other coloumns as well


Dear @AvratanuBiswas ,
Thank you for your kind input. I’ll check the code with my program.

And, to let you know, I follow your Youtube tutorials on streamlit. Great Work!!

Thanks & Reagrds,
Amrit Mandal.

1 Like

Hey @amrit ,

Thank you for your kind words, glad to hear !