I am attempting to use the scipy Simpson function to integrate timeseries data, but I am having doubts about the value it returns as it doesn't match up with what I am expecting to get. Here is my data. It's just one column of timestamps and one column of floats.
Here's my code:
# p is the filepath
df = pd.read_excel(p)
df.columns = ['t','P']
df['t'] = pd.to_timedelta(pd.to_datetime(df['t']).dt.strftime('%H:%M:%S')).dt.total_seconds() / 3600
x = simpson(df['P'],df['t'])
y = df['P'].mean() * (df['t'].max()-df['t'].min()) / 3600
When I take a simple average of my data and multiply by the duration (~2 hrs), I get around 1000, which is what I am expecting to get. However, the Simpson function keeps returns around 655, well below what my expectations. The data forms a simple rectangle when graphed so not sure what is causing this issue.
Graphed Data
Any idea where I am going wrong? Thanks in advance for your help!