bug fix: column specification for shuffle

dev
Steve L. Nyemba 4 years ago
parent 6a6352169c
commit abed87db22

@ -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) :

Loading…
Cancel
Save