I am somewhat new to coding in Python with Pandas and I'm having lots of trouble trying to create a separate data frame from my original data frame.
I am trying to create a specific date range and create a new data frame to be able to use to create a line plot with matplotlib.
I have read multiple questions on here that pertain to my problem but does not seem to fix it. Here is my code where I go into my data frame and then define what specific date range I want exactly in it and then average the daily temperatures together.
This picture shows that it skips certain dates (like in the DAY column you see 10, 20, 30) even though my data frame does have each date in it.
import pandas as pd
df['Date'] = df.YR.astype(str) + df.MN.astype(str) + df.DAY.astype(str)
df.Date = pd.to_datetime(df.Date, format = '%Y%m%d')
start_date = '2018-07-20'
end_date = '2019-08-10'
mask = (df.Date > start_date) & (df.Date <= end_date)
df_18_19 = df.loc[mask]
daily_18_19 = df_18_19.groupby(['Date']).mean()