In Python, I want to parse a string and return the numeric portion (may or may not have decimal point) as a float and return the suffix as a string. Examples are:
7.1inch -> 7.1, inch
7.1” -> 7.1, “
7in -> 7.0, in
-10dB -> -10.0, dB
-10.2dB -> -10.2, dB
There’s no space between the numeric portion and suffix. Also, I want to apply this to a Pandas DataFrame column that has this format so that I can sort by the floating point value. I then want to append the suffix back to each element in the column after the sort. Kindly advise on the code to do this. Thanks!