简体   繁体   中英

'numpy.ndarray' object has no attribute 'value'

My working code has suddenly stopped working today because of this error. Can someone please help me in solving this?

style = Styler(bg_color = 'red',font_size=10)
sf = StyleFrame(filtered_data)
#Getting Error at following line:
sf.apply_column_style(cols_to_style=filtered_data.columns.to_list(),style_header=True,styler_obj=Styler(font_size=10,font='Calibri',wrap_text = False)) 

The filtered_data columns are timestamps:

>>> print(filtered_data.columns.to_list())  
['KPI', Timestamp('2020-11-06 00:00:00'), Timestamp('2020-11-06 01:00:00'), 
Timestamp('2020-11-06 02:00:00'), Timestamp('2020-11-06 03:00:00'), 
Timestamp('2020-11-06 04:00:00'), Timestamp('2020-11-06 05:00:00'), 
Timestamp('2020-11-06 06:00:00'), Timestamp('2020-11-06 07:00:00'), 
Timestamp('2020-11-06 08:00:00'), Timestamp('2020-11-09 00:00:00'), 
Timestamp('2020-11-09 01:00:00'), Timestamp('2020-11-09 02:00:00'), 
Timestamp('2020-11-09 03:00:00'), Timestamp('2020-11-09 04:00:00'), 
Timestamp('2020-11-09 05:00:00'), Timestamp('2020-11-09 06:00:00'), 
Timestamp('2020-11-09 07:00:00'), Timestamp('2020-11-09 08:00:00'), 
Timestamp('2020-11-10 00:00:00'), Timestamp('2020-11-10 01:00:00'), 
Timestamp('2020-11-10 02:00:00'), Timestamp('2020-11-10 03:00:00'), 
Timestamp('2020-11-10 04:00:00'), Timestamp('2020-11-10 05:00:00'), 
Timestamp('2020-11-10 06:00:00'), Timestamp('2020-11-10 07:00:00'), 
Timestamp('2020-11-10 08:00:00'), Timestamp('2020-11-11 00:00:00'), 
Timestamp('2020-11-11 01:00:00'), Timestamp('2020-11-11 02:00:00'), 
Timestamp('2020-11-11 03:00:00'), Timestamp('2020-11-11 04:00:00'), 
Timestamp('2020-11-11 05:00:00'), Timestamp('2020-11-11 06:00:00'), 
Timestamp('2020-11-11 07:00:00'), Timestamp('2020-11-11 08:00:00')]

Other inputs are as follows:

>>from styleframe.version import get_all_versions
>>print(get_all_versions())
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
pandas 1.0.3
openpyxl 3.0.4
StyleFrame 3.0.5

The data is too big to be able to be taken dump. I finally managed to take its csv and while, I was taking its screenshot to show here, I noticed that one column name was mentioned twice. I think, That is why the error occurred! I am looking at the file carefully to see if I find more such columns. Thanks for finding out time to reply to my question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM