Pandas get topmost n records within each group
Suppose I have pandas DataFrame like this:
Suppose I have pandas DataFrame like this:
I have two models A and B. All B objects have a foreign key to an A object. Given a set of A objects, is there anyway to use the ORM to get a set of B objects containing the most recent object created for each A object.