I have a table Mapping
that looks like this
Mapping
+---------+---------+
| user_id | prod_id |
+---------+---------+
| 41 | N12ad |
| 2 | nd5Ed |
| 73 | bDe4d |
| 25 | M87he |
+---------+---------+
I would like to add a column ranking
that numbers the rows in the order that they are stored in the database. So that it looks like this
+---------+---------+---------+
| user_id | prod_id | ranking |
+---------+---------+---------+
| 41 | N12ad | 1 |
| 9 | nd5Ed | 2 |
| 73 | bDe4d | 3 |
| 25 | M87he | 4 |
+---------+---------+---------+
In Microsoft SQL, I can do
SELECT user_id, prod_id, ROW_NUMBER() OVER(PARTITION BY (SELECT NULL)) AS ranking
FROM Mapping
What would be the pandas equivalent of ROW_NUMBER() OVER(PARTITION BY (SELECT NULL))
? Thank you for your help.