insert the value of a variable in a panda dataset


I happen to have the following dataset

in which I must insert the title column (which must contain only Mr, Mrs, Miss, as the case may be) between the survived and name columns,

I did it in the following way:

otra=data_tres['name'].str.split(expand=True) otra[(1)]

with this I divide the chain and extract the data that I need, this is saved in the other vbla.

0          Mr.

1          Mr.
2         Mrs.
3          Mr.
4          Mr.
5          Mr.
6          Mr.
7          Mr.
8        Miss.
9          Mr.
10         Mr.
11         Mr.

in this way ..

How can I insert this column in the position indicated above?

asked by rose dewitt 03.12.2018 в 23:05

0 answers