<jupyter_start><jupyter_text>https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html<jupyter_code>df.head(5)
color = (df.Supplier == 'Matt').map({True: 'background-color: yellow', False: ''})
df.style.apply(lambda s: color)
# df['Amount Agreed'] = df['Amount Agreed'].replace(np.nan, -1)
# df['Buyer'] = df['Buyer'].replace(np.nan, -1)
# df['Effective Date'] = df['Effective Date'].replace(np.nan, -1)
# df['Expires On'] = df['Expires On'].replace(np.nan, -1)
df.loc[:].style.highlight_null(null_color='yellow')
df
color = (df.Supplier == 'Matt').map({True: 'background-color: yellow', False: ''})
df.style.apply(lambda s: color)
df['Amount Agreed'].style.highlight_null('red')
# df['Expires On'] = pd.to_datetime(df['Expires On'])
# df['Effective Date'] = pd.to_datetime(df['Effective Date'])

df
df['Expires On'] = df['Expires On'].dt.strftime('%m/%d/%Y')

start_date = '2000-01-01'
end_date = '2021-12-01'
mask = (df['Expires On'] > start_date) & (df['Expires On'] <= end_date)
  
expired = df.loc[mask]
expired
df = pd.DataFrame([[2,3,1], [3,2,2], [2,4,4]], columns=list("ABC"))

df.style.apply(lambda x: ["background: red" if v > x.iloc[0] else "" for v in x], axis = 1)
def highlight_max(s, props=''):
    return np.where(s == 2, props, '')
df.apply(highlight_max, props='color:white;background-color:darkblue', axis=0)
start_date = '2021-12-01'
end_date = '2030-12-01'
mask = (df['Expires On'] > start_date) & (df['Expires On'] <= end_date)
  
    
active_bpas = df.loc[mask]
active_bpas.head()
def highlight_80(y):
    if y.Consumed > .8:
        return ['background-color: yellow']*14
    else:
        return ['background-color: white']*14
df.style.apply(highlight_80, axis=1)
def equals(y):
    if y.EffectiveDate == 0.997050:
        return ['background-color: orange']*14
    else:
        return ['background-color: white']*14
df.style.apply(equals, axis=1)

# Create some Pandas dataframes from some data.
df1 = pd.DataFrame({'Data': [11, 12, 13, 14]})
df2 = pd.DataFrame({'Data': [21, 22, 23, 24]})
df3 = pd.DataFrame({'Data': [31, 32, 33, 34]})

# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter('Test2.xlsx', engine='xlsxwriter')

# Write each dataframe to a different worksheet.
df.to_excel(writer, sheet_name='ACTIVE BPAS')
non_emea_bpa.to_excel(writer, sheet_name='NON EMEA BPAS')
expired.to_excel(writer, sheet_name='EXPIRED')

# Close the Pandas Excel writer and output the Excel file.
writer.save()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1956, 'fraction_numerical': 0.04, 'mean_word_length': 5.1, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '493697', 'license': 'MIT', 'n_tokens_mistral': 1024, 'n_tokens_neox': 955, 'n_words': 204, 'path': 'Test Project.ipynb', 'repo_name': 'rstrong341/EMEA-Project', 'size': '2500'}