This commit is contained in:
Steve Nyemba 2021-04-04 12:09:34 -05:00
parent 73115724fe
commit 856d1e4bd7
1 changed files with 13 additions and 12 deletions

View File

@ -218,18 +218,19 @@ class Components :
# df = args['data'] # df = args['data']
_cast = {} _cast = {}
if schema : if schema :
dtype = str for _item in schem :
name = schema['name'] dtype = str
novalue = -1 name = _item['name']
if schema['type'] == 'INTEGER' : novalue = -1
dtype = np.int64 if _item['type'] == 'INTEGER' :
dtype = np.int64
elif schema['type'] == 'FLOAT' :
dtype = np.float64 elif _item['type'] == 'FLOAT' :
else: dtype = np.float64
novalue = '' else:
_cast[schema['name']] = dtype novalue = ''
df[name] = df[name].fillna(novalue).astype(dtype) # _cast[schema['name']] = dtype
df[name] = df[name].fillna(novalue).astype(dtype)
_info = {"module":"gan-prep","action":"read","shape":{"rows":df.shape[0],"columns":df.shape[1]},"schema":schema} _info = {"module":"gan-prep","action":"read","shape":{"rows":df.shape[0],"columns":df.shape[1]},"schema":schema}
logger.write(_info) logger.write(_info)