I have a dataframe with a numeric column and I would link to calculate the percentile of the values in each row for that column considering only previous rows of the column. Here is an example:
+-------+
| col_1 |
+-------+
| 5 |
+-------+
| 4 |
+-------+
| 10 |
+-------+
| 1 |
+-------+
| 7 |
+-------+
I would like to obtain a dataframe like this:
+-------+------------+
| col_1 | percentile |
+-------+------------+
| 5 | 100 |
+-------+------------+
| 4 | 50 |
+-------+------------+
| 10 | 100 |
+-------+------------+
| 1 | 25 |
+-------+------------+
| 7 | 80 |
+-------+------------+
How can I calculate it?