Suppose I have the following data frame below:
userid recorddate
0 tom 2018-06-12
1 nick 2019-06-01
2 tom 2018-02-12
3 nick 2019-06-02
How would I go about determining and pulling the value for the earliest recorddate for each user. i.e. 2018-02-12 for tom and 2019-06-01 for nick?
In addition, what if I added a parameter such as the earliest recorddate that is greater than 2019-01-01?
Everything will be easier if you convert your date strings into datetime objects. Once that's done you can sort them then take the first record per userid. Additionally you can filter the dataframe by passing a date string in your conditional, and proceed the same way.
output
or