I have a dataframe data
. I have a column data['T']
and a column data['p']
.
When using a function called TPFLSHdll
I get the following error
TypeError: cannot convert the series to <class 'float'>
The code is the following:
import os
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
# connetto Python alle librerie REFPROP (prende in automatico la cartella)
RP = REFPROPFunctionLibrary(os.environ['RPPREFIX'])
RP.SETPATHdll(os.environ['RPPREFIX'])
RP.SETUPdll(1, 'WATER.FLD', "HMX.BNC","DEF")
D, Dl, Dv, x, y, q, e, h, s, Cv, Cp, w, ierr, herr = RP.TPFLSHdll(data['T'], data['P'], [1])
I experienced a similar trouble in the past, solved in the following:
import os
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
# connetto Python alle librerie REFPROP (prende in automatico la cartella)
RP = REFPROPFunctionLibrary(os.environ['RPPREFIX'])
RP.SETPATHdll(os.environ['RPPREFIX'])
RP.SETUPdll(1, 'WATER.FLD', "HMX.BNC","DEF")
D, Dl, Dv, x, y, q, e, h, s, Cv, Cp, w, ierr, herr = RP.TPFLSHdll(data['T'].values, data['P'].values, [1])
This solution to add .values
doesn't work and I get the following TypeError: only size-1 arrays can be converted to Python scalars
Any suggestion to avoid FOR cycle?