79497086

Date: 2025-03-10 05:35:22
Score: 1
Natty:
Report link

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?

Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • High reputation (-1):
Posted by: khteh