I am working with two dataframes, let's name them time and voltage, and their shape is [2201 rows x 8 columns].
The first and last rows of the dataframes are (time and voltage respectively):
A = 2.90 V A = 3.00 V A = 3.10 V A = 3.20 V A = 3.30 V A = 3.40 V A = 3.50 V A = 4.90 V
0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
1 2.000000e-09 2.000000e-09 2.000000e-09 2.000000e-09 2.000000e-09 2.000000e-09 2.000000e-09 2.000000e-09
2 4.000000e-09 4.000000e-09 4.000000e-09 4.000000e-09 4.000000e-09 4.000000e-09 4.000000e-09 4.000000e-09
3 6.000000e-09 6.000000e-09 6.000000e-09 6.000000e-09 6.000000e-09 6.000000e-09 6.000000e-09 6.000000e-09
4 8.000000e-09 8.000000e-09 8.000000e-09 8.000000e-09 8.000000e-09 8.000000e-09 8.000000e-09 8.000000e-09
... ... ... ... ... ... ... ... ...
2196 4.392000e-06 4.392000e-06 4.392000e-06 4.392000e-06 4.392000e-06 4.392000e-06 4.392000e-06 4.392000e-06
2197 4.394000e-06 4.394000e-06 4.394000e-06 4.394000e-06 4.394000e-06 4.394000e-06 4.394000e-06 4.394000e-06
2198 4.396000e-06 4.396000e-06 4.396000e-06 4.396000e-06 4.396000e-06 4.396000e-06 4.396000e-06 4.396000e-06
2199 4.398000e-06 4.398000e-06 4.398000e-06 4.398000e-06 4.398000e-06 4.398000e-06 4.398000e-06 4.398000e-06
2200 4.400000e-06 4.400000e-06 4.400000e-06 4.400000e-06 4.400000e-06 4.400000e-06 4.400000e-06 4.400000e-06
[2201 rows x 8 columns]
A = 2.90 V A = 3.00 V A = 3.10 V A = 3.20 V A = 3.30 V A = 3.40 V A = 3.50 V A = 4.90 V
0 0.003537 0.007219 0.012674 0.017294 0.022206 0.027240 0.032120 0.106918
1 0.003532 0.007214 0.012666 0.017288 0.022212 0.027280 0.032082 0.106855
2 0.003537 0.007217 0.012677 0.017342 0.022264 0.027290 0.032008 0.106764
3 0.003535 0.007221 0.012671 0.017352 0.022236 0.027307 0.032054 0.106809
4 0.003539 0.007224 0.012675 0.017336 0.022244 0.027320 0.032064 0.106836
... ... ... ... ... ... ... ... ...
2196 0.000399 0.000490 0.000579 0.000164 0.000176 0.000230 0.000238 0.000336
2197 0.000406 0.000495 0.000578 0.000146 0.000216 0.000237 0.000252 0.000227
2198 0.000405 0.000495 0.000577 0.000188 0.000192 0.000273 0.000230 0.000264
2199 0.000402 0.000494 0.000573 0.000138 0.000216 0.000193 0.000240 0.000200
2200 0.000408 0.000492 0.000572 0.000170 0.000210 0.000253 0.000224 0.000373
I can eaily plot the curves for each column (voltage vs time). I would like to get the derivative of the voltage dataframe respect the time dataframe, or what it is the same in mathemetics (dvoltage/dtime) and then plot (dvoltage/dtime) vs time.
I have tried the following code:
def Derivative():
dV_dt = []
for c in range(len(V.columns)):
dn = derivative(V.iloc[:,c], time.iloc[:,c], dx=time.iloc[:,c])
dV_dt.append(dn)
dV_dt = pd.DataFrame(dV_dt)
print(dV_dt)
raising the following error:
File "C:\ProgramData\Anaconda3\Lib\site-packages\scipy\misc\common.py", line 119, in derivative
val += weights[k]*func(x0+(k-ho)*dx,*args)
TypeError: 'Series' object is not callable
Does anyone how to solve this? Thanks in advance.