Skip to content
Snippets Groups Projects
Commit 74082f94 authored by Peter Lünenschloß's avatar Peter Lünenschloß
Browse files

made normscale project constant series onto 0.5 (to avoid all_nan series return)

parent 158f0e6e
No related branches found
No related tags found
2 merge requests!193Release 1.4,!188Release 1.4
Pipeline #5456 passed with stage
in 6 minutes and 55 seconds
Subproject commit 8264b2540025709465b2db0c23a074d97e31182c
Subproject commit e9a80225b02799fa668882149a39f4a734b4f280
......@@ -87,8 +87,13 @@ def scale(ts, target_range=1, projection_point=None):
def normScale(ts):
# func scales series to [0,1] interval and projects constant series onto 0.5
ts_min = ts.min()
return (ts - ts_min) / (ts.max() - ts_min)
ts_max = ts.max()
if ts_min == ts_max:
return pd.Series(data=0.5, index=ts.index)
else:
return (ts - ts_min) / (ts.max() - ts_min)
def standardizeByMean(ts):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment