AttributeError: 'numpy.ndarray' object has no attribute 'style'
See original GitHub issueThanks for your work
- Python 3.7.3
- StyleFrame 2.0.5
- pandas 0.25.3
- openpyxl 3.0.2
I want to read an xlsx file as described in this SO answer, but I get the following error
Code
sf = StyleFrame.read_excel(file_path,
sheet_name=1,
index_col=0,
read_style=True
)
Error
lib/python3.7/site-packages/StyleFrame/style_frame.py in _read_style()
208 style_object = Styler.from_openpyxl_style(current_cell, theme_colors,
209 read_comments and current_cell.comment)
--> 210 sf.at[sf_index, col_name].style = style_object
211 sf._rows_height[row_index] = sheet.row_dimensions[row_index].height
212
AttributeError: 'numpy.ndarray' object has no attribute 'style'
Do you I make a mistake somewhere or is there a bug ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
AttributeError: 'numpy.ndarray' object has no attribute 'xaxis'
When trying to create a plot with multiple figures, I get this error AttributeError: 'numpy.ndarray' object has no attribute 'xaxis'.
Read more >AttributeError: 'numpy.ndarray' object has no attribute ' ...
The problem is that train_test_split(X, y, ...) returns numpy arrays and not pandas dataframes. Numpy arrays have no attribute named columns.
Read more >How to Fix: 'numpy.ndarray' object has no attribute 'index'
One error you may encounter when using NumPy is: AttributeError: 'numpy.ndarray' object has no attribute 'index'.
Read more >'numpy.ndarray' object has no attribute 'append' Solution
ndarray' object has no attribute 'append' error indicates you are using the regular Python append() method to add an item to a NumPy...
Read more >numpy.ravel — NumPy v1.24 Manual
As of NumPy 1.10, the returned array will have the same type as the input array. ... 'C' means to index the elements...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, got it resolved, used df.set_index before.
After removing it, everything works smoothly.
@MattMacs Please provide a full code that reproduces this issue.