Looking to create a table like this in Jupiter Notebook based on a pandas DataFrame. While styler has much on how to format data, much typically done in excel/word is formatting text to make it quickly readable. I'm aiming to cut excel/word out of process entirely and use pandas styler to summarize entire workflow. I have found limited documentation on how to format the text values/column widths/etc of data in index. I'm not familiar with HTML/CSS and am winging it. What I've tried seemed to have no impact on display of table. This is my data and some of code I've tried:
from faker import Faker
faker = Faker()
Faker.seed(4321)
dat = pd.DataFrame(
{'WorkFlow':[ 'Macro Economic Changes'
,'Industry Changes'
,'Federal Legislative Changes'
,'Model Development'
,'Model Validation'
,'Model Production Testing'
,'Market Research'
,'Marketing Plan'
,'Marketing Material'
,'Client Solicitation']})
choices = ['Marketing','Management','Research']
conditions = [dat['WorkFlow'].str.find('Market')>-1
,dat['WorkFlow'].str.find('Change')>-1
,dat['WorkFlow'].str.find('Model' )>-1]
dat['Dept']= np.select(conditions,choices,'BusinessDev')
dat['AssignedAssociate'] =dat['WorkFlow'].apply(lambda x: faker.name())
dat['StatusReport']=np.array(['Green']*5+['Yellow']+['Green']*3+['Red'])
dat['StatusReport']= dat['StatusReport']+": Due to ...sdf asdfasf asdfasdfas asdgfasdfasdfsadfsadf. asdfsafsaf asdfsafsadf"
dat.set_index(['Dept','WorkFlow'],inplace=True)
dat
dat.style.set_table_styles(
# { 'selector': 'th.col_heading'
# , 'props' : 'text-align: center;' },
{'selector' : 'th.index_name.'
, 'props' : [('text-align','center')
,('font-weight','bold')
,('font-style','italic')
,('width','2%')
,('overflow-wrap','break-word')]} )