You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this should be a 1) dedicated DataFrame method, 2) a method on DataFrameGroupBy, or 3) call to aggregate with a specific function.
# 1df=DataFrame()
new_df=df.remove_duplicates(('key1', 'key2'))
#2new_df=df.groupby(('key1', 'key2')).first(check_identical=True) # take only the first row for each group, make sure all other rows with this key have the same values#3new_df=df.groupby(('key1', 'key2')).aggregate(first_row) # some function that takes the first row for each group
Should be reasonably performant, probably just use sets +
np.apply_along_axis
The text was updated successfully, but these errors were encountered: