bugfix: logs for formatting dates

This commit is contained in:
Steve Nyemba 2022-04-14 12:42:11 -05:00
parent 1ff4145eea
commit febcaa5883
1 changed files with 5 additions and 1 deletions

View File

@ -263,6 +263,7 @@ class Generator (Learner):
pass pass
def format(self,_df,_schema): def format(self,_df,_schema):
r = {}
for _item in _schema : for _item in _schema :
name = _item['name'] name = _item['name']
@ -273,9 +274,12 @@ class Generator (Learner):
else: else:
if _item['type'] == ['DATETIME','TIMESTAMP'] : if _item['type'] == ['DATETIME','TIMESTAMP'] :
FORMAT = '%Y-%d-%m %H:%M:%S' FORMAT = '%Y-%d-%m %H:%M:%S'
self.log(**{'action':'format','input':{'name':name,'format':FORMAT}}) r[name] = FORMAT
_df[name] = pd.to_datetime(_df[name], format=FORMAT).astype(str) #.astype('datetime64[ns]') _df[name] = pd.to_datetime(_df[name], format=FORMAT).astype(str) #.astype('datetime64[ns]')
if r :
self.log(**{'action':'format','input':r})
return _df return _df
pass pass