Как создать стиль с цветом градиента фона a Python Pandas Dataframe с помощью словаря - PullRequest
0 голосов
/ 05 августа 2020

У меня есть следующий pandas фрейм данных с индексом «NUM»:

enter image description here

The values in the dictionary values (lists) are the index in the dataframe. I want to add background gradient color to the cells, for example in "R1" column color 1 to 10, in "R2" column color 3 to 20 and so on.

I want to add background gradient color to cells using the following dictionary:

d =  {'R1': [1,2,3,4,5,6,7,8,9,10]
,'R2': [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
,'R3': [7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
,'R4': [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
,'R5': [17,18,19,20,21,22,23,24,25,26,27,28]
}

I wish a result like this:

enter image description here

Similar problem is showing up in: Как стилизовать Python Pandas Dataframe с использованием словаря

Но применяет однородный цвет.

Спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...