I would like to:
- delete the words "ANOS" and "ANO";
- replace "A" to "TO"; and
- replace "<1ano" to "0 to 1".
Example: "10 A 19 ANOS" to "10 to 19"
data = pd.DataFrame({'FAIXA_ETARIA': ['10 A 19 ANOS',' 20 A 29 ANOS', '30 A 39 ANOS', '40 A 49 ANOS',
'50 A 59 ANOS', ' 60 A 69 ANOS', '70 A 79 ANOS', '80 A 89 ANOS',
'<1ANO'],
'Count': [3, 8, 28, 7, 15, 9, 3, 5, 3]})
PS: My database presents many columns, I would like this procedure to be performed only in column "FAIXA_ETARIA"
Thanks for your help!
https://regex101.com/to practice. I think there's a Python implementation available (on the left side of the window under "FLAVOR").