I am trying to run my script in Databricks using dataframe_image library to style my table and later save this as .png file and getting an error OsError: Chrome executable not able to be found on your machine. Per documentation I need to add table_conversion = 'matplotlib'
import pandas as pd
import numpy as np
np.random.seed(0)
df = pd.DataFrame(np.random.randn(10,4), columns=['A','B','C','D'])
def highlight_max(s, props=''):
return np.where(s == np.nanmax(s.values), props, '')
styled_table = df.style.apply(highlight_max, props='color:red;', axis=1)\
.set_properties(**{'background-color': '#ffffb3'})
import dataframe_image as dfi # you might need to pip install dataframe-image
dfi.export(styled_table, 'file1.png', table_conversion = 'matplotlib')
As result all styles are lost.
Note: When I ran the same script in Jupyter using table_conversion = 'chrome' everything was working fine. I was wondering if there is a workaround. Any recommendations are welcome. Thanks.
For a Debian based os:
apt install chromium-chromedriver
Solved it for me.
Chrome executable error #6
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