I have a dataset that has multiple location and the number of visits by week. I want to filter out the locations that did not have any visitors in the most recent week.
I have tried the following:
df_select = df.loc[(df['end_date'] == "3/17/2023") & (df['visits'] != 0)]
df_group = df.groupby(['id','name','lat', 'lng']).agg({'visits': ['count']})
When I try this I get the following error: “ValueError: cannot reindex from a duplicate axis”