From d89daf76d6758424a6c316b1690fce364f32ef4f Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Thu, 16 Jun 2022 23:56:16 -0500 Subject: [PATCH] bug fixes --- data/maker/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/data/maker/__init__.py b/data/maker/__init__.py index 60fc418..541db37 100644 --- a/data/maker/__init__.py +++ b/data/maker/__init__.py @@ -59,7 +59,7 @@ class Learner(Process): # @TODO: allow for verbose mode so we have a sens of what is going on within the newtork # - _log = {'action':'init','context':self.info['context'],'gpu':(self.gpu if self.gpu is not None else -1)} + _log = {'action':'init','gpu':(self.gpu if self.gpu is not None else -1)} self.log(**_log) # self.logpath= _args['logpath'] if 'logpath' in _args else 'logs' @@ -67,8 +67,10 @@ class Learner(Process): def log(self,**_args): # self.lock.acquire() try: + _context = self.info['context'] + _label = self.info['info'] if 'info' in self.info else _context logger = transport.factory.instance(**self.store['logger']) if 'logger' in self.store else transport.factory.instance(provider='console',context='write',lock=True) - _args = dict({'ndx':self.ndx,'module':self.name,'table':self.info['from'],'info':self.info['context'],**_args}) + _args = dict({'ndx':self.ndx,'module':self.name,'table':self.info['from'],'context':_context,'info':_info,**_args}) logger.write(_args) self.ndx += 1 if hasattr(logger,'close') : @@ -345,7 +347,7 @@ class Generator (Learner): _type = np.float if _type : - _df[name] = _df[name].fillna(0).replace('',0).replace('NA',0).replace('nan',0).astype(_type) + _df[name] = _df[name].fillna(0).replace(' ',0).replace('',0).replace('NA',0).replace('nan',0).astype(_type) # else: # _df[name] = _df[name].astype(str) # _df = _df.replace('NaT','').replace('NA','') @@ -397,7 +399,10 @@ class Generator (Learner): # print (_df[cols]) writer = transport.factory.instance(**_store) - writer.write(_df[:],schema=_schema) + if _store['provider'] == 'bigquery': + writer.write(_df,schema=[],table=self.info['from']) + else: + writer.write(_df,table=self.info['from'])