Skip to content

Commit

Permalink
Minimal Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
argenisleon committed Nov 10, 2019
1 parent 4193b87 commit 6525251
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion optimus/dataframe/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ def nest(input_cols, shape="string", separator="", output_col=None):

if shape is "vector":
input_cols = parse_columns(self, input_cols, filter_by_column_dtypes=PYSPARK_NUMERIC_TYPES)

output_col = one_list_to_val(output_col)
vector_assembler = VectorAssembler(
inputCols=input_cols,
outputCol=output_col)
Expand Down
6 changes: 2 additions & 4 deletions optimus/ml/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ def string_to_index(df, input_cols, output_cols=None, **kargs):
:return: Dataframe with indexed columns.
"""

# input_cols = parse_columns(df, input_cols)
input_cols = parse_columns(df, input_cols)
if output_cols is None:

output_cols = [name_col(input_col, "index_to_string") for input_col in input_cols]
print(output_cols)

indexers = [StringIndexer(inputCol=input_col, outputCol=output_col, **kargs).fit(df) for input_col, output_col
in zip(list(set(input_cols)), list(set(output_cols)))]

pipeline = Pipeline(stages=indexers)
df = pipeline.fit(df).transform(df)
# df.show()

return df


Expand Down

0 comments on commit 6525251

Please sign in to comment.