I'm trying to parse a whois database file with the following format, where each "inetnum" with its following attributes represents a row in my final table.
The file looks like this:

```
inetnum:        inetnum_example1
netname:        netname_example1
descr:          descr_example1
descr:          descr_example1
status:         status_example1
mnt-by:         mnt-by_example1
inetnum:        inetnum_example2
netname:        netname_example2
status:         status_example2
mnt-by:         mnt-by_example2
mnt-by:         mnt-by_example2
inetnum:        inetnum_example3
netname:        netname_example3
...

```

and the final result looks like this:

```
   row                    descr                  descr_1                  inetnum                   mnt-by                 mnt-by_1                  netname                   status
0    1           descr_example1           descr_example1         inetnum_example1          mnt-by_example1                      NaN         netname_example1          status_example1
1    2                      NaN                      NaN         inetnum_example2          mnt-by_example2          mnt-by_example2         netname_example2          status_example2
2    3                      NaN                      NaN         inetnum_example3                      NaN                      NaN         netname_example3                      NaN

```

To do so, I'm using the following script. However, as you can see some columns with the same name are labelled with a number and treated independently.

**My question is: As the column values will always be strings, is there a way to concatenate all the values from the columns with the same name into a single one?**
Using the previous example, the first row would only have a "descr" column with both previous values concatenated, and the same for the "mnt-by" column in the second row.

Desired output (delimiter can be any random char(set), as ',' in this case):

```
   row                    descr                     inetnum                   mnt-by                                netname                   status
   0    1           descr_example1,descr-example1   inetnum_example1          mnt-by_example1                       netname_example1          status_example1
   1    2                      NaN                  inetnum_example2          mnt-by_example2,mnt-by-example2       netname_example2          status_example2
   2    3                      NaN                  inetnum_example3          NaN                                   netname_example3          NaN 

```

Any idea would be highly appreciated, thanks a lot for your time

Script:

```
import pandas
import sys
mydb = pandas.read_table(sys.argv[1], encoding="ISO-8859-1", header=None)
mydb.columns = ['data']
mydb = mydb['data'].str.split(': ',1,expand=True)
mydb = mydb.set_index([0,(mydb[0] == 'inetnum').cumsum().rename('row')])
mydb = mydb.set_index(mydb.groupby([0,'row']).cumcount(), append=True)
mydb = mydb.reset_index('row')
mydb.index = mydb.index.map('{0[0]}_{0[1]}'.format)
mydb = mydb.set_index(['row'], append=True)[1].unstack(0)
mydb = mydb.rename(columns=lambda x: x.split('_0')[0]).reset_index()
print(mydb)

```