I don't think you need to apply .sum twice. I think annual_energy_dc =
dc[['p_mp']].sum() should be a float; if it's not, then I'd check the dimensions of dc[['p_mp']].
pvlib makes "instantaneous" calculations, that is, it calculates the DC power (at maximum power conditions) at each time stamp. Using hourly input data, you are implicitly modeling each hour by the hour's single value of irradiance, temperature, etc. So summing as the above code is implicitly assuming that each hour's energy (in Whr) is equal to the hour's power (W) x duration (1 hour).
The equations for the SAPM and CEC models are quite different, and hence require different parameters. Using the CEC model is a two step process:
- first use the function pvsystem.calcparams_cec to translate irradiance etc. to the five coefficients for the single diode equation
- use pvsystem.singlediode to get the points on the IV curve, including p_mp.
I hope the documentation for these two functions makes it clear.
Cheers,
Cliff