Home > Software design >  Highlighting excel cells based on the cell values using pandas dataframe and xlsxwriter
Highlighting excel cells based on the cell values using pandas dataframe and xlsxwriter

Time:01-25

I have a csv file. After doing certain process, it has to be saved as an excel file.

I am opening it as pandas dataframe and after doing some cleaning (renaming and rearranging columns, dropping few columns), i have to replace null values or if the cell value is "N/A" to "DN". Currently i am using two lines of code for this.

df.replace('', np.nan, inplace = True)
df.replace('N/A', np.nan, inplace = True)
df = df.fillna("DN")

Then, i have to highlight cells which has the value "DN" with yellow color

I am trying with the code mentioned in this post enter image description here

Export from df

enter image description here

CodePudding user response:

You can't save a enter image description here enter image description here

  • Related