Skip to content

Commit

Permalink
Handle round as dataframe operation
Browse files Browse the repository at this point in the history
  • Loading branch information
argenisleon committed Oct 17, 2018
1 parent aa32325 commit c6a2b4f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions optimus/dataframe/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,6 @@ def parse_col_names_funcs_to_keys(data):
temp_func_name = f + "_"
if k.startswith(temp_func_name):
_col_name = k[len(temp_func_name):]
# If the value is numeric only get 5 decimals
if is_numeric(v):
v = round(v, 5)
_result.setdefault(_col_name, {})[f] = v
return _result
else:
Expand All @@ -470,7 +467,8 @@ def parse_col_names_funcs_to_keys(data):
expression = []
for col_name in columns:
for func in funcs:
expression.append(func(col_name).alias(func.__name__ + "_" + col_name))
# If the value is numeric only get 5 decimals
expression.append(F.round(func(col_name), 5).alias(func.__name__ + "_" + col_name))

result = parse_col_names_funcs_to_keys(format_dict(df.agg(*expression).to_json()))
# logging.info(result)
Expand Down

0 comments on commit c6a2b4f

Please sign in to comment.