bug fix: column specification for shuffle

This commit is contained in:
Steve Nyemba 2021-04-12 15:11:41 -05:00
parent 6a6352169c
commit abed87db22
1 changed files with 4 additions and 3 deletions

View File

@ -224,12 +224,13 @@ class Components :
if 'ignore' in args and 'columns' in args['ignore'] : if 'ignore' in args and 'columns' in args['ignore'] :
_cols = self.get_ignore(data=df,columns=args['ignore']['columns']) _cols = self.get_ignore(data=df,columns=args['ignore']['columns'])
columns = args['columns'] if 'columns' in args else df.columns
for name in list (set(df.columns) - set(_cols)) : columns = list(set(columns) - set(_cols))
for name in columns :
i = np.arange(df.shape[0]) i = np.arange(df.shape[0])
np.random.shuffle(i) np.random.shuffle(i)
if name in x_cols : if name in x_cols :
df[name] = self.approximate(df[name].values) df[name] = self.approximate(df.iloc[i][name].values)
df[name] = df.iloc[i][name] df[name] = df.iloc[i][name]
self.post(data=df,schema=schema,store=args['store']['target']) self.post(data=df,schema=schema,store=args['store']['target'])
def post(self,**_args) : def post(self,**_args) :