✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Error message:Invalid value of type 'pandas.core.frame.DataFrame' received for the 'close' property of ohlc

the line of the code which resulted in the error:

trace2 = go.Ohlc(x=HA.index,open=HA.open, high=HA.high,low=HA.low,close=HA.close, name=‘heikenashi’)

this is how HA dataframe looks like:
open high low close
date
2017-11-01 00:00:00 1.289725 1.289725 1.289725 1.289725
2017-11-01 01:00:00 1.289725 1.290720 1.289700 1.290155
2017-11-01 02:00:00 1.289940 1.290660 1.289940 1.290328
2017-11-01 03:00:00 1.290134 1.290520 1.289530 1.290083
2017-11-01 04:00:00 1.290108 1.290460 1.289760 1.290097

i tried to print and compare HA.low and HA.close, they are the same.

this is the complete error messages:
ValueError:
Invalid value of type ‘pandas.core.frame.DataFrame’ received for the ‘close’ property of ohlc
Received value: close
date
2017-11-01 00:00:00 1.289725
2017-11-01 01:00:00 1.290155
2017-11-01 02:00:00 1.290328
2017-11-01 03:00:00 1.290083
2017-11-01 04:00:00 1.290097
2017-11-01 05:00:00 1.290353
2017-11-01 06:00:00 1.290315
2017-11-01 07:00:00 1.289895
2017-11-01 08:00:00 1.288825
2017-11-01 09:00:00 1.288227
2017-11-01 10:00:00 1.287853
2017-11-01 11:00:00 1.288050
2017-11-01 12:00:00 1.289550
2017-11-01 13:00:00 1.290205
2017-11-01 14:00:00 1.289062
2017-11-01 15:00:00 1.289098
2017-11-01 16:00:00 1.288533
2017-11-01 17:00:00 1.288050
2017-11-01 18:00:00 1.287968
2017-11-01 19:00:00 1.287310
2017-11-01 20:00:00 1.286410
2017-11-01 21:00:00 1.286503
2017-11-01 22:00:00 1.286787
2017-11-01 23:00:00 1.287305
2017-11-02 00:00:00 1.286435
2017-11-02 01:00:00 1.284810
2017-11-02 02:00:00 1.283780
2017-11-02 03:00:00 1.283530
2017-11-02 04:00:00 1.283462
2017-11-02 05:00:00 1.283530
… …
2017-11-10 03:00:00 1.267525
2017-11-10 04:00:00 1.267352
2017-11-10 05:00:00 1.267340
2017-11-10 06:00:00 1.266990
2017-11-10 07:00:00 1.267445
2017-11-10 08:00:00 1.267670
2017-11-10 09:00:00 1.267567
2017-11-10 10:00:00 1.267362
2017-11-10 11:00:00 1.267360
2017-11-10 12:00:00 1.267345
2017-11-10 13:00:00 1.267745
2017-11-10 14:00:00 1.268587
2017-11-10 15:00:00 1.268128
2017-11-10 16:00:00 1.268280
2017-11-10 17:00:00 1.268725
2017-11-10 18:00:00 1.268798
2017-11-10 19:00:00 1.268343
2017-11-10 20:00:00 1.267850
2017-11-10 21:00:00 1.268360
2017-11-12 22:00:00 1.269188
2017-11-12 23:00:00 1.269215
2017-11-13 00:00:00 1.269357
2017-11-13 01:00:00 1.269328
2017-11-13 02:00:00 1.269200
2017-11-13 03:00:00 1.269008
2017-11-13 04:00:00 1.268843
2017-11-13 05:00:00 1.268468
2017-11-13 06:00:00 1.268450
2017-11-13 07:00:00 1.268995
2017-11-13 08:00:00 1.270030

[200 rows x 1 columns]

The 'close' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series

Could anyone tell me how to solve this?
Thank you!

Hi @yanzifan,

That is odd. The error message indicates that the close argument is being set to a pandas DataFrame (where in this case it should be a pandas Series). What is the type of HA.close if you check directly?

type(HA.close)

If type(HA) is a DataFrame then I would expect this to be a Series.

-Jon