How Do I Groupby Strings Of Text By A Nominal/Ordinal Variable In Python?

Viewed 17

I have scraped the entire tweet history of a person using snscrape and pandas, and now have a dataframe with the following general format:

Index | Year | Month | Tweet     | Username
01    | 2011 | 02    | String1   | JoESchmoe
02    | 2011 | 03    | String2   | JoESchmoe
03    | 2012 | 01    | String3   | JoESchmoe
04    | 2012 | 04    | String4   | JoESchmoe

What I want to do is concatenate all of the strings together based on my different date variables. Ideally, I would like to be able to get a dataframe something like this:

Index | Year | Tweet           | Username
01    | 2011 | String1.String2 | JoESchmoe
02    | 2012 | String3.String4 | JoESchmoe

Based on what I've read sofar, it seems that groupby is the appropriate function to perform this action, but if there is another way I would love to hear about it!

Thanks in advance for your time!

0 Answers
Related