So I was previously running some code for a pollution dataset, and the code was running just fine. Now, I get this error: Colors must be aRGB hex values
The only line of code I have is the following:
pollution_jawn = pd.read_excel('ObservationData_irkfioc copy.xlsx')
I have no idea what the issue is, and I even tried deleting this file from my jupyterhub directory and uploading it, but even that did not work.
Had similar issue, but found simple solution, just to reassign method set in RGB class in openpyxl/styles/colors.py, catching error with 'Colors must be aRGB hex values' and setting another color like white:
from openpyxl.styles.colors import WHITE, RGB
__old_rgb_set__ = RGB.__set__
def __rgb_set_fixed__(self, instance, value):
try:
__old_rgb_set__(self, instance, value)
except ValueError as e:
if e.args[0] == 'Colors must be aRGB hex values':
__old_rgb_set__(self, instance, WHITE) # Change color here
RGB.__set__ = __rgb_set_fixed__
Hope it will help somebody
The .xlsx file was probably saved in an older version of Excel. What worked for me was to simply open the .xlsx file in a new version of Excel and then save it again. After that the error didn't turn up again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With