def initialize(self):
""" Perform basic checks on provided attributes.
"""
if isinstance(self.on, str):
self.on = [self.on]
elif not isinstance(self.on,list):
raise Exception('on is not a list of strings. Exit.')
assert len(self.on) > 0, 'not specified on which keys to merge.'
assert (self.how == 'inner' or self.how == 'outer' or self.how == 'left' or self.how == 'right'), \
'how to merge not specified correctly.'
assert len(self.output_collection), 'output_collection not specified.'
# add back on to kwargs, so it's picked up by pandas.
if self.on is not None:
self.kwargs['on'] = self.on
if self.how is not None:
self.kwargs['how'] = self.how
self.log().info('kwargs passed on to pandas merge function are: %s' % self.kwargs )
return StatusCode.Success
评论列表
文章目录