Click here to Skip to main content
15,846,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
###I have been trying to carry out some mathematical operations the DataFrame as follows:

###Here is the data frame:

DfD =

   D1  D2  D3  D4  D5  D6  D7  D8  D9  I   ... P3  P4  P5  P6  P7  P8  P9  R   S   time
   0   [0.0, 4.495308187547649e-06, 3.560980908381618...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
   0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0,
   0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0,
   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0,
   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
   ...   [10.0, 9.956694041903512, 9.913575624407693, 9...   ... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
   0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0,
   0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0,
   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...   [0.0, 0.08510849164745524,
   0.1669133041179413,...   [60.0, 59.99999725256998, 59.99997823553143, 5...   [0.0, 0.1, 0.2,
   0.30000000000000004, 0.4, 0.5,...





### I got the Error message:
ValueError: Setting an array element with a sequence.

What I have tried:

###Here is the code:

Python
import pandas as pd
import numpy as np

### Defining constant parameters:
T=(100+273.15); # Operating temperature in degrees Kelvin,K.
R= 8.3145; #J.mol^-1.K^-1.

### Pre-defining the kinetic parameters we have:
f= 0.85;#2*89.91*math.exp(-14240/(T*R));
k_d = 4.340*10**(-2);
k_p = 2.170*10**(7)*math.exp(-3.243*10**(7)/(T*R));
k_t = 8.2*10**(9)*math.exp(-1.145*10**(7)/(T*R));

### Mathematically Manipulating the DataFrame
np.seterr(invalid='ignore')
dfD = pd.DataFrame(d_result)
dfD = dfD.astype(float)
vpD=np.multiply(np.sqrt(np.true_divide((f*k_d*dfD['M']),k_t)),k_p*dfD['M'])
vpD
Posted
Comments
Richard MacCutchan 27-Mar-22 5:01am    
Which line gives the error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900