For the following dataframe,
d = {'col1': [33,33,33,34,34,34], 'col2': ["hello","hello1","hello2","hello3","hello4","hello5"]}
df = pd.DataFrame(data=d)
print(d)
I want it to group by col1
and the content in col2
are concatenate as a list, the result is as followed:
import pandas as pd
d = {'col1': [33,34], 'col2': [["hello","hello1","hello2"],["hello3","hello4","hello5"]]}
df = pd.DataFrame(data=d)
print(d)
Is there an easy way to achieve that?