virgo-modules 0.0.79__py3-none-any.whl → 0.0.81__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of virgo-modules might be problematic. Click here for more details.
- virgo_modules/src/re_utils.py +55 -1
- {virgo_modules-0.0.79.dist-info → virgo_modules-0.0.81.dist-info}/METADATA +1 -1
- {virgo_modules-0.0.79.dist-info → virgo_modules-0.0.81.dist-info}/RECORD +6 -6
- {virgo_modules-0.0.79.dist-info → virgo_modules-0.0.81.dist-info}/LICENSE +0 -0
- {virgo_modules-0.0.79.dist-info → virgo_modules-0.0.81.dist-info}/WHEEL +0 -0
- {virgo_modules-0.0.79.dist-info → virgo_modules-0.0.81.dist-info}/top_level.txt +0 -0
virgo_modules/src/re_utils.py
CHANGED
|
@@ -453,7 +453,61 @@ def ranking(data, weighted_features, top = 5, window = 5):
|
|
|
453
453
|
top_up = list(df.sort_values('up_signas', ascending = False).index)[:top]
|
|
454
454
|
top_low = list(df.sort_values('low_signas', ascending = False).index)[:top]
|
|
455
455
|
|
|
456
|
-
return top_up, top_low
|
|
456
|
+
return top_up, top_low, df
|
|
457
|
+
|
|
458
|
+
def ranking_first(data, weighted_features, top = 5, window = 5):
|
|
459
|
+
'''
|
|
460
|
+
Create a ranking of assets given current signals and weighted average importance
|
|
461
|
+
|
|
462
|
+
Parameters:
|
|
463
|
+
data (pd.Dataframe): base data
|
|
464
|
+
weighted_features (dict): configuration dictionary
|
|
465
|
+
top (int): top n to get result
|
|
466
|
+
window (int): number of days to assess
|
|
467
|
+
|
|
468
|
+
Returns:
|
|
469
|
+
top_up (list): top roof signal asset
|
|
470
|
+
top_low (list): top botton signal asset
|
|
471
|
+
'''
|
|
472
|
+
features = weighted_features.keys()
|
|
473
|
+
up_columns = ['signal_up_' + x for x in features]
|
|
474
|
+
low_columns = ['signal_low_' + x for x in features]
|
|
475
|
+
|
|
476
|
+
def compute_score(df,col,window):
|
|
477
|
+
score = 0
|
|
478
|
+
for i in range(window):
|
|
479
|
+
row = df.iloc[i]
|
|
480
|
+
if (row[col] == 1) and (i == 0):
|
|
481
|
+
score += 1000
|
|
482
|
+
elif (row[col] == 1) and (i == 1):
|
|
483
|
+
score -= 200
|
|
484
|
+
elif (row[col] == 1) and (i >= 2):
|
|
485
|
+
score -= 50
|
|
486
|
+
return score
|
|
487
|
+
|
|
488
|
+
ticket_list= list(data.Ticket.unique())
|
|
489
|
+
result = dict()
|
|
490
|
+
for ticket in ticket_list:
|
|
491
|
+
result[ticket] = dict()
|
|
492
|
+
df = data[data.Ticket == ticket].sort_values('Date').iloc[-window:]
|
|
493
|
+
|
|
494
|
+
for col in low_columns:
|
|
495
|
+
df = df.sort_values('Date', ascending = False)
|
|
496
|
+
score = compute_score(df,col,window)
|
|
497
|
+
result[ticket][col] = score
|
|
498
|
+
for col in up_columns:
|
|
499
|
+
score = 0
|
|
500
|
+
df = df.sort_values('Date', ascending = False)
|
|
501
|
+
score = compute_score(df,col,window)
|
|
502
|
+
result[ticket][col] = score
|
|
503
|
+
|
|
504
|
+
df = pd.DataFrame(result).T
|
|
505
|
+
df['up_signas'] = df[up_columns].sum(axis=1)
|
|
506
|
+
df['low_signas'] = df[low_columns].sum(axis=1)
|
|
507
|
+
|
|
508
|
+
top_up = list(df.sort_values('up_signas', ascending = False).index)[:top]
|
|
509
|
+
top_low = list(df.sort_values('low_signas', ascending = False).index)[:top]
|
|
510
|
+
return top_up, top_low, df
|
|
457
511
|
|
|
458
512
|
def produce_dashboard(data, columns , ticket_list, show_plot = True, nrows = 150,save_name = False, save_path = False, save_aws = False, aws_credential = False):
|
|
459
513
|
'''
|
|
@@ -3,10 +3,10 @@ virgo_modules/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
3
3
|
virgo_modules/src/aws_utils.py,sha256=q0l7D7ofo09Lu1QQjv-esheQ06uiSy1Pdq3xMul8zvk,2571
|
|
4
4
|
virgo_modules/src/edge_utils.py,sha256=ll5pRs9EE20IsE5A1vA589TKzobkeA-b0d68jNTsu1U,13268
|
|
5
5
|
virgo_modules/src/pull_artifacts.py,sha256=5OPrgR7pcMSdpbevDRhf0ebk7g7ZRjff4NpTIIWAKjE,1989
|
|
6
|
-
virgo_modules/src/re_utils.py,sha256=
|
|
6
|
+
virgo_modules/src/re_utils.py,sha256=a7u7ouZ6dKvJZXzgjPLTRARbCapMC_sWf-azhExpMAk,71590
|
|
7
7
|
virgo_modules/src/ticketer_source.py,sha256=4J0y51Tv0dGzFU7qZarGBIJSFsFWfY_NDNWZI6VN2Ws,142729
|
|
8
|
-
virgo_modules-0.0.
|
|
9
|
-
virgo_modules-0.0.
|
|
10
|
-
virgo_modules-0.0.
|
|
11
|
-
virgo_modules-0.0.
|
|
12
|
-
virgo_modules-0.0.
|
|
8
|
+
virgo_modules-0.0.81.dist-info/LICENSE,sha256=pNgFyCYgmimaw0o6V20JupZLROycAnOA_HDDh1tX2V4,1097
|
|
9
|
+
virgo_modules-0.0.81.dist-info/METADATA,sha256=UGDIXRdC6k8suA5Nv58zset6OqVUoEp5rqUUmju0P6Y,1429
|
|
10
|
+
virgo_modules-0.0.81.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
11
|
+
virgo_modules-0.0.81.dist-info/top_level.txt,sha256=ZjI-qEkDtT-8mFwGAWnXfqPOKEGlIhWRW1es1VyXc60,14
|
|
12
|
+
virgo_modules-0.0.81.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|