Related questions

0 votes
0 answers
asked Apr 12, 2017 in Python by anonymous
0 votes
1 answer
0 votes
0 answers
0 votes
1 answer

How to convert a series of one value to float only?

0 votes
asked Jul 21, 2017 in Python by anonymous

1 Answer

0 votes

I have a series which has only one value and i want to get that value only. I ran a code to get t he value by index matching and i got a series like this:

(normal_sum['KWH'][(normal_sum['KWH'].index == date)])

Timestamp
2017-04-02    2934.93
Freq: D, Name: KWH, dtype: float64

But when i tried to convert it into a float by this:

float(normal_sum['KWH'][(normal_sum['KWH'].index == date)])

It is throwing an error:

TypeError: cannot convert the series to <type 'float'>

Expected output: 2934.93

Any help would be appreciated.

answered Jul 21, 2017 by anonymous
...