I am working on the processing of excel files that have a work data form.
I am currently using Pandas and I get lists for each field consisting of 2 cells.
The problem that occurs to me now is in terms of the data of the worker's children, since this can have more than 1, and the form was filled using spaces to separate the names within the same cell, so I get the following:
['NOMBRE Y APELLIDO DE HIJOS:', 'MARIANA ROSALES YESENIA ROSALES']
I access this one in the following way:
dato_personal[1]
My question is:
Is there any way to cut the text string so that it is left
["MARIANA", "ROSALES", "YESENIA", "ROSALES"]
, or even for 3 names and last names?
It would be something like cutting in each space, but I can not think of the form, I found it was like cutting in a certain occurrence:
posicion_de_corte = dato_personal[1].replace(" ", 'X', 2).find(" ")
primer_dato = dato_personal[1][:posicion_de_corte]
primer_dato_clean = primer_dato.strip()
But it only works well for 2 two names.
And if I use a for cycle, when looking for the occurrence of space, something like:
15 16 17 18 19 20 21 22 23
, which are all blank spaces