Python inequality join with group by
Python inequality join with group by Question: I have the following two dataframes import pandas as pd dates = [’31-12-2015′, ’31-12-2016′, ’31-12-2017′, ’31-12-2018′] df1 = pd.DataFrame({‘id’: [1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4], ‘t’: dates*4, ‘stage’: [1,2,2,3,1,1,2,3,1,1,1,3,2,1,1,3]}) df2 = df1.loc[df1[‘stage’] == 1] What is the most efficient way of doing the operation below in python? Select a.id ,a.t ,max(b.stage = 2) …