DKM
DKM

Reputation: 1801

DataFrame Formatted Output

So I'm a newbie here at the stack and on python. My sample dataframe and expected output are mentioned below. Please help.

I have a data frame which writing to excel using xlsxwriter engine. Sample dataframe snapshot is here.

Target: I want to search each row having the total at first column and apply formatting as shown in the below screenshot until the end of the column. Expected output screenshot

Tried to find the way of reading all the rows having total in data frame using

Total = final_df[final_df['Placement# Name'] == 'Total']

but now can't figure out, how to format them, main point is to format color.

Upvotes: 0

Views: 159

Answers (1)

Joe
Joe

Reputation: 12417

In general to fill a cell you can use this:

format = workbook.add_format()
format.set_bg_color('green')

And adding the parameter cell_format=format in

worksheet.write()

You can find more info here

Upvotes: 1

Related Questions