Pandas style object with multi-index

前端 未结 4 1346
广开言路
广开言路 2020-12-16 17:25

I am formatting a pandas dataframe with styler to highlight columns and format numbers. I also want to apply multi-index for more clear, pleasant and easy to read. Since I a

4条回答
  •  失恋的感觉
    2020-12-16 18:00

    Here, is another way:

    data.style.background_gradient(cmap=cm, subset=data.columns.get_loc_level('A', level=1)[0])
    

    Output:

提交回复
热议问题