I filter out the Nan
or Null values first and use 0
as the value for them in the new columns.
import numpy
df["min"] = df[df["values"].notnull()]["values"].map(lambda x: int(minimum) if x and (minimum:=str(x).split(" - ")[0]) else 0)df["max"] =
df[df["values"].notnull()].map(lambda x: int(maximum) if x and " - " in str(x) and (maximum:=str(x).split(" - ")[1]) else 0)
However, the columns have a .0
decimal point. How to get rid of it?