def cal(grp):
row = grp.head(1)
row['AETERM'] = grp['AETERM'].tolist()
return row
temp1_a = temp1_a.groupby('Subject',as_index=False).apply(cal)
ValueError: Length of values does not match length of index
def cal(grp):
row = grp.head(1)
row['AETERM'] = grp['AETERM'].tolist()
return row
temp1_a = temp1_a.groupby('Subject',as_index=False).apply(cal)
ValueError: Length of values does not match length of index