I am trying to automate a code. I would like to have the code pull data starting at the beginning of the month to end of the previous day. Currently I am using the following command to get the enddate:
dateEnd = pd.to_datetime('today')
How do tell the code, based on what today is to go back to the beginning of the month? AND, how do I tell the code if its the first of the month to return the previous months data?
For a bonus, once I have the start and end date, how do return find the number of days in the month? I have tried this command, but it does not want to work on a single date.
startTime_date.dt.daysinmonth