Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Creates a empty dataframe
- dataset0514maxrec = pd.DataFrame(columns=dataset0514max.columns.values)
- dataset0514maxrec.index.name = 'Date'
- #Gets the unique values, find the groups, recover the max value and append it
- for i in dataset0514max.index.unique():
- tempDF1 = dataset0514max.loc[dataset0514max.index.isin([i])]
- tempDF2 = tempDF1[tempDF1['Data_Value'] == tempDF1['Data_Value'].max()]
- dataset0514maxrec = dataset0514maxrec.append(tempDF2.head(1))
- print(dataset0514maxrec)
Add Comment
Please, Sign In to add comment