So I have a table that looks like the following:
0 | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
rs10000911 | 4 | 144136193 | 100.000000 | - | AC |
rs10000988 | 4 | 76010255 | 99.173554 | - | AG |
rs10002181 | 4 | 142250415 | 100.000000 | + | AG |
rs10005140 | 4 | 22365603 | 99.173554 | + | AG |
rs10005242 | 4 | 5949558 | 100.000000 | + | AG |
Now I want to create an additional row or a series that would contain a combination of columns 1 and 2 that looks like this: 4:144136193, 4:76010255, 4:142250415, etc. Now I am using an iterrows solution:
new_column = pd.Series([])
for index, line in table.iterrows():
new_column = new_column.append(pd.Series(str(line[1])+':'+str(line[2])))
Because my table contains 800 000 rows iterrows is very slow. Is there any way to speed this up?