This commit is contained in:
Steve Nyemba 2022-04-14 11:41:30 -05:00
parent 7a22314a46
commit 528e6db0b8
1 changed files with 5 additions and 4 deletions

View File

@ -306,7 +306,7 @@ class Shuffle(Generator):
This is a method that will yield data with low utility This is a method that will yield data with low utility
""" """
def __init__(self,**_args): def __init__(self,**_args):
super().__init__(self) super().__init__(**_args)
def run(self): def run(self):
@ -315,7 +315,8 @@ class Shuffle(Generator):
np.random.shuffle(_index) np.random.shuffle(_index)
_iocolumns = self.info['columns'] _iocolumns = self.info['columns']
_ocolumns = list(set(self._df.columns) - set(_iocolumns) ) _ocolumns = list(set(self._df.columns) - set(_iocolumns) )
_iodf = pd.DataFrame(self._df[_ocolumns],self._df.loc[_index][_iocolumns],index=np.arange(self._df.shape[0])) # _iodf = pd.DataFrame(self._df[_ocolumns],self._df.loc[_index][_iocolumns],index=np.arange(_index.size))
_iodf = pd.DataFrame(self._df[_iocolumns],index = np.arange(_index.size))
self._df = self._df[_ocolumns].join(_iodf) self._df = self._df[_ocolumns].join(_iodf)
@ -336,8 +337,8 @@ class factory :
:param autopilot will generate output automatically :param autopilot will generate output automatically
:param batch (default 2k) size of the batch :param batch (default 2k) size of the batch
""" """
if _args['apply'] == 'shuffe' : if _args['apply'] == 'shuffle' :
return Shuffle(**_args) return Shuffle(**_args)
elif _args['apply'] == 'generate' : elif _args['apply'] == 'generate' :
return Generator(**_args) return Generator(**_args)