TypeError: Sequenz kann nicht mit Nicht-Int vom Typ 'float' (Python 2.7) multipliziert werden
Ich habe einen Datenrahment_unit
, das ist das Ergebnis einespd.read_csv()
Funktion.
datetime B18_LR_T B18_B1_T
24/03/2016 09:00 21.274 21.179
24/03/2016 10:00 19.987 19.868
24/03/2016 11:00 21.632 21.417
24/03/2016 12:00 26.285 24.779
24/03/2016 13:00 26.897 24.779
Ich nehme ein Resampling des Datenrahmens vor, um das 5. und 05. Perzentil mit dem folgenden Code zu berechnen:
keys_actual = list(t_unit.columns.values)
for key in keys_actual:
ts_wk = t_unit[key].resample('W-MON')
ts_wk_05p = ts_wk.apply(lambda x: x.quantile(0.05)).round(decimals=1).rename(key+'_05p', inplace=True)
ts_wk_95p = ts_wk.apply(lambda x: x.quantile(0.95)).round(decimals=1).rename(key+'_95p', inplace=True)
All funktioniert einwandfrei, aber wenn ich meinem Datenframe eine Spalte hinzufüge, mittelspd.concat
, in:
datetime B18_LR_T B18_B1_T ext_T
24/03/2016 09:00 21.274 21.179 6.9
24/03/2016 10:00 19.987 19.868 7.5
24/03/2016 11:00 21.632 21.417 9.1
24/03/2016 12:00 26.285 24.779 9.9
24/03/2016 13:00 26.897 24.779 9.2
ts_wk_05p = ts_wk.apply (Lambda x: x.quantile (0.05)). round (decimals = 1) .rename (key + '_ 05p', inplace = True)
TypeError: Sequenz kann nicht mit Nicht-Int vom Typ 'float' multipliziert werden
Hast du eine Ahnung warum?