0
Dog start # end #
scooby 7 10
scooby 8 11
scooby 9 12
roscoe 2 5
roscoe 3 6
roscoe 4 7

I have the above dataframe. I want it to look at this and look to see if the value of dog is matching anywhere in the data frame, to then look at the values of start # and end # and give it as one line. based off max and min. I want one line with the dogs minimum start # and the dogs maximumn end #

Dog start # end #
scooby 7 12
roscoe 2 7
lost
  • 3
  • 2
  • Are the start/end always consecutive within a group? Can there be gaps and what should happen? Try `df.groupby('Dog', as_index=False).agg({'start #', 'min', 'end #': 'max'})` – mozway Sep 24 '22 at 03:37

0 Answers0