|
|
|
@ -244,7 +244,14 @@ class Generator (Learner):
|
|
|
|
|
return _date.strftime(FORMAT)
|
|
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
def format(self,_df):
|
|
|
|
|
def format(self,_df,_schema):
|
|
|
|
|
for _item in _schema :
|
|
|
|
|
name = _item['name']
|
|
|
|
|
if _item['type'].upper() in ['DATETIME','TIMESTAMP'] :
|
|
|
|
|
|
|
|
|
|
_df[name] = pd.to_datetime(_df[name], format='%Y-%m-%d %H:%M:%S').astype('datetime64[ns]')
|
|
|
|
|
return _df
|
|
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
def post(self,_candidates):
|
|
|
|
|
|
|
|
|
@ -275,7 +282,7 @@ class Generator (Learner):
|
|
|
|
|
_df[name] = _dates
|
|
|
|
|
_schema = self.get_schema()
|
|
|
|
|
_schema = [{'name':_item.name,'type':_item.field_type} for _item in _schema]
|
|
|
|
|
|
|
|
|
|
_df = self.format(_df,_schema)
|
|
|
|
|
writer.write(_df,schema=_schema)
|
|
|
|
|
|
|
|
|
|
self.log(**{'module':self.name,'action':'write','input':{'rows':N,'candidates':len(_candidates)}})
|
|
|
|
|