in datasets/noaa/pipelines/_images/run_csv_transform_kub/csv_transform.py [0:0]
def shorthand_to_number(x) -> float:
if isinstance(x, float) or isinstance(x, int):
return x
if "K" in x:
if len(x) > 1:
return float(x.replace("K", "")) * 10**3
return 10**3
if "M" in x:
if len(x) > 1:
return float(x.replace("M", "")) * 10**6
return 10**6
if "B" in x:
if len(x) > 1:
return float(x.replace("B", "")) * 10**9
return 10**9
if "T" in x:
if len(x) > 1:
return float(x.replace("T", "")) * 10**12
return 10**12
if "Q" in x:
if len(x) > 1:
return float(x.replace("Q", "")) * 10**15
return 10**15
return 0.0