So I have this Pandas DataFrame.
I am trying to figure out how to write this in python.
For each row I want to say, "if the 'Bid_Size' is a different value that the 'Bid_Size' in the previous row, highlight this cell.
For instance in my provided data set, row #3/column-'Bid_Size' would be highlighted because it is a different value than the 'Bid_Size' in the previous row.
I am guessing it would go something like
import pandas as pd
file = pd.read_csv('DataBase.csv', header=None, names=['Book_ID','Asset','Best_Bid','Bid_Size','Best_Ask', 'Ask_Size'])
df = pd.DataFrame(file)
def highlight_yellow(df):
for rows in df:
if df['Best_Bid'] != -['Best_Bid']:
return['highlight:yellow']
df.style.apply(highlight_yellow)
Thank you, I just can not figure this one out.
