I know there are a lot of questions on find and replace in Python however the answer I'm looking for must be buried deep somewhere because I cannot find it. lol
I have a list:
list = ['Product', 'Price', 'Storage', 'Shape', 'Percentage', 'VM/Prem', 'Location', 'Azure', '£200', '1.5TB', 'Square', '2.4%', 'Virtual', 'Europe', 'AWS', '£300', '1.9TB', 'Oval', '3.0%', 'Virtual', 'Europe', 'GCP', '£400', '2.4TB', 'Square', '3.0%', 'Virtual', 'Europe', 'Azure', '£400', '3.5TB', 'Square2.4%', 'Virtual', 'Europe', 'Azure', '£600', '6.5TB', 'Square 8.4%', 'Virtual', 'Europe']
As you can see from this list above when we put it into a DataFrame the columns shift to the left because 'Square2.4%' and 'Square 8.4%' should be 2 separate elements each. So I'm expecting: 'Square', '2.4%' and 'Square', '8.4%'.
Is there a solution to find square and then an integer using regex so find 'SquareN' and then split where the integer starts?
For the second element there is also a space which regex would need to look for: 'Square 8.4%' Or is there a better solution to this?
I have tried find.replace and also changing after I put it into an array, but I have been unable to find a way to make 2 elements by splitting the list as it would be the most optimum solution to prevent hard coding the values.
Thank You, any help would be greatly appreciated. :)