I'm relatively new to Python and I encountered an issue I can't seem to solve. I have imported an excel sheet in Python - it's full of Timestamps and corresponding glucose values.
I got my code to display timestamp-glucose pairs for a specific timeframe with the purpose of being able to analyze separate chunks from the data. So now I can just specify that I only want the data from the afternoon or the morning or X day before I hit 'Run'.
I want to run some basic calculations. I want to be able to enter the time-range and then get average glucose ONLY for the specified time period, but I'm struggling. I get the average glucose of the whole data by simply having this line:
print(df['Historic Glucose mmol/L'].mean())
But when it comes to getting averages for the specified time period I'm not sure how to do it. I looked into questions on here but couldn't find similar ones. Additionally, I have looked at possible numpy functions but I don't think they would help. If anyone has any suggestions I'd be grateful. Below is a chunk of code that gets me the specified timeframes:
dataSubSection = df
sDate = datetime(2019,11,21,17,17,00)
eDate = datetime(2019,11,22,00,00,0)
start_date = sDate.strftime('%Y-%m-%d %H:%M:%S')
end_date = eDate.strftime('%Y-%m-%d %H:%M:%S')