Pandas DataFrame groupby based on condition
问题 The most similar question I found was here but with no proper answer. Basically I have an issue where I'm trying to use groupby on a dataframe to generate unique IDs for bus routes. The problem is, the data I have at my disposal sometimes (though rarely) has the same values for my groupby columns, so they're considered the same bus even though they aren't. The only other way I can think of is to group buses based on another column called "Type of stop", where there is an indicator for Start,