I have a dataframe df1 with the following rows:
df1['col1']
asd1 12KVsdf
pqr 11.2 KVsdf
I am trying the following:
df1['col1'].extract(r'(\d*\.\d+\sKV)|(\d+\sKV)')
This gives:
df1['col1']
0 1
12KV NaN
NaN 11.2 KV
I am trying to extract all numerals immediately preceding KV.
My desired output is:
df1['col1']
0
12KV
11.2 KV