I would like to identify values in a column that have a specific format and then replace one of the elements, the 'x' with a '0'. For instance, the format is " >=3.1.x " or " >=9.5.x ". The desired output is " >=3.1.0 " or " >=9.5.0". How do I replace the x with a 0?
Below is the code I started with:
format_x = re.compile(r"(?P<convert>(?:[>]?=?\d+\.\d+\.x))")
def convert_format_x(x):
match = format_x.search(x["column_4"])
convert = match.group("convert")
return
testing = testdata['column_4'].apply(convert_constraint, axis = 1)
Output:
AttributeError: 'NoneType' object has no attribute 'group'