У меня есть датафрейм, как показано ниже.Я хочу сделать новый столбец с общим количеством шагов.Я получил таблицу, как показано ниже.Вы можете видеть, что ID 1 состоит из 5 шагов.
+----+--------------------------------------------------------+
| ID | Steps |
+----+--------------------------------------------------------+
| 1 | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> |
| 2 | <DIV><P>Another step</P></DIV> |
| | <DIV><P>Something</P></DIV> |
| | <DIV><P>Something</P></DIV> |
| | <DIV><P>Something</P></DIV> |
| | <DIV><P>Something</P></DIV> |
+----+--------------------------------------------------------+
Я хочу использовать 'DIV', чтобы подсчитать общее количество шагов по правильному идентификатору и создать новый столбец с общим количеством шагов.
+----+--------------------------------------------------------+-------------+
| ID | Steps | Total_Steps |
+----+--------------------------------------------------------+-------------+
| 1 | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> | 10 |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> | |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> | |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> | |
| | <DIV><P>Another step</P></DIV><DIV><P>A step</P></DIV> | |
| 2 | <DIV><P>Another step</P></DIV> | 5 |
| | <DIV><P>Something</P></DIV> | |
| | <DIV><P>Something</P></DIV> | |
| | <DIV><P>Something</P></DIV> | |
| | <DIV><P>Something</P></DIV> | |
| 3 | <DIV><P>Just a step</P></DIV> | 4 |
| | <DIV><P>Just a step</P></DIV> | |
| | <DIV><P>Just a step</P></DIV> | |
| | <DIV><P>Just a step</P></DIV> | |
+----+--------------------------------------------------------+-------------+