for example, my data frame is:
| ID | time | number |
|---|---|---|
| a | 14:03:01 | 11 |
| b | 14:03:02 | 7 |
| b | 14:03:15 | 2 |
| c | 14:03:09 | 5 |
| a | 14:03:02 | 9 |
| d | 14:03:17 | 1 |
| a | 14:03:35 | 15 |
| c | 14:03:11 | 8 |
I sort this data frame by time and for each ID I want to get the value of the number column for the earliest time. I know the solution is SQL but now, I get confused to do it for pandas.
| ID | number |
|---|---|
| a | 11 |
| b | 7 |
| c | 5 |
| d | 1 |
How can I do these using pandas? (I don't want to use "for loop" .)