Reputation: 31
I'm a beginner in python and trying to find the area under a curve that is created by a data set rather than defined by a function. I currently have a dataframe with data in some columns (series) and corresponding days elapsed values in another column.
I'm trying to create a new dataframe (or simply add columns to the existing one if possible) of the cumulative area under the curve vs. days elapsed. I'm trying to do this using scipy.integrate.cumtrapz and integrate over a day length of 2.
At this point, I'm using the following code to attempt this. The dataframe column I'm using is "Flux" and the elapsed days column is "ElapseTime_day".
How would I create this in a dataframe format with one column for cumulative area and a corresponding days elapsed column? My goal is to be able to apply some basic conversion operations on the cumulative area column values and then plot the data against days elapsed.
import scipy
from scipy import integrate
area_cumulative= scipy.integrate.cumtrapz(df1_S3["Flux"], x=df1_S3["ElapseTime_day"], dx=2)
Any help is much appreciated! Thanks!
Upvotes: 1
Views: 191