I have a data frame that has multiple duplicated instances, sorted by date. It looks like this:
And I am trying to merge the rows by date for matching "Keywords", and sum the "Views" count.
The result I am looking to obtain is the following:
Could anyone hint me how I could achieve that in Python? Thank you.
The data frame:
df = pd.DataFrame([["3/8/14", "adapter", 2], ["3/8/14", "adapter", 5], ["3/8/14", "charger", 1],
["13/8/14", "adapter", 1], ["13/8/14", "battery-case", 0]],
columns=['Date', 'Keyword', 'Views'])
df.groupby(['Date', 'Keyword'])['Views'].sum().reset_index()
– Albie