bugfix: formatter
This commit is contained in:
parent
9f198f3b15
commit
1ff4145eea
|
@ -265,9 +265,17 @@ class Generator (Learner):
|
|||
def format(self,_df,_schema):
|
||||
for _item in _schema :
|
||||
name = _item['name']
|
||||
if _item['type'].upper() in ['DATETIME','TIMESTAMP'] :
|
||||
|
||||
if _item['type'].upper() in ['DATE','DATETIME','TIMESTAMP'] :
|
||||
FORMAT = '%Y-%d-%m'
|
||||
if 'format' in self.info and name in self.info['format'] :
|
||||
FORMAT = self.info['format'][name]
|
||||
else:
|
||||
if _item['type'] == ['DATETIME','TIMESTAMP'] :
|
||||
FORMAT = '%Y-%d-%m %H:%M:%S'
|
||||
self.log(**{'action':'format','input':{'name':name,'format':FORMAT}})
|
||||
|
||||
_df[name] = pd.to_datetime(_df[name], format='%Y-%m-%d %H:%M:%S').astype('datetime64[ns]')
|
||||
_df[name] = pd.to_datetime(_df[name], format=FORMAT).astype(str) #.astype('datetime64[ns]')
|
||||
return _df
|
||||
|
||||
pass
|
||||
|
@ -298,6 +306,7 @@ class Generator (Learner):
|
|||
_dates = [self.make_date(year=year,field=name) for year in years]
|
||||
if _dates :
|
||||
_df[name] = _dates
|
||||
|
||||
_schema = self.get_schema()
|
||||
_schema = [{'name':_item.name,'type':_item.field_type} for _item in _schema]
|
||||
_df = self.format(_df,_schema)
|
||||
|
|
2
setup.py
2
setup.py
|
@ -4,7 +4,7 @@ import sys
|
|||
|
||||
def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
args = {"name":"data-maker","version":"1.5.1",
|
||||
args = {"name":"data-maker","version":"1.5.2",
|
||||
"author":"Vanderbilt University Medical Center","author_email":"steve.l.nyemba@vumc.org","license":"MIT",
|
||||
"packages":find_packages(),"keywords":["healthcare","data","transport","protocol"]}
|
||||
args["install_requires"] = ['data-transport@git+https://dev.the-phi.com/git/steve/data-transport.git','tensorflow']
|
||||
|
|
Loading…
Reference in New Issue