Question: I have a dataframe like this 

```
   Name    Data
0  file1   a
1  file2   b
2  file1   c
3  file1   d
4  file2   e

```

I want to group by "Name" and concatenet the column "Data".

Output should look like this:
`file1 acd
file2 be`
I'm not able to figure it out how to do that. I can convert the dataframe into a list and then run a for loop and do it. But I'm trying to see if there's a better way to do it not using list.

Thanks in advance!!

Answer: 
You can just `groupby` and `sum`:

```
print (df.groupby("Name").sum())

      Data
Name      
file1  acd
file2   be

```
Something like `df.groupby('Name').apply(lambda x: ''.join(x['Data']))` should get you there...check out group\_concat in sql, you're looking to do exactly that