mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-26 05:23:37 +00:00
23 lines
629 B
Python
23 lines
629 B
Python
import math
|
|
|
|
# def csv_colunm_foramt(val):
|
|
# if str(val).find("$") >= 0:
|
|
# return float(val.replace("$", "").replace(",", ""))
|
|
# if str(val).find("¥") >= 0:
|
|
# return float(val.replace("¥", "").replace(",", ""))
|
|
# return val
|
|
import pandas as pd
|
|
|
|
|
|
def csv_colunm_foramt(val):
|
|
try:
|
|
if pd.isna(val):
|
|
return math.nan
|
|
if str(val).find("$") >= 0:
|
|
return float(val.replace("$", "").replace(",", ""))
|
|
if str(val).find("¥") >= 0:
|
|
return float(val.replace("¥", "").replace(",", ""))
|
|
return val
|
|
except ValueError:
|
|
return val
|