I am quite new to python. I want to map to the latest version. If there are two versions in Software_Version column always need to choose the second one which is the latest version.
Sofware_Component Software_Version
Python 2.7
Python 2.7,3.6
R 3.5.0,3.6.0
R 3.5.0
Code to replace the latest version:
result4.loc[result4['COMPONENT_VERSION'].str.contains(',')] = result4['COMPONENT_VERSION'].str.split(',').str[-1]
ERROR:ValueError: cannot index with vector containing NA / NaN values
Code to map which is working fine
result4['Software_Componenet'] = result4['SOFTWARE_COMPONENT'].map(str)+' '+result4['COMPONENT_VERSION'].map(str)
I am expecting the result as below
Software_Component
Python 2.7
Python 3.6
R 3.6.0
R 3.5.0