Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BacksGas_Flow_sccm ContextID StepID Time_Elapsed iso_forest
- 61.81640625 7289972 19 40.503 -1
- 62.59765625 7289972 19 41.503 -1
- 63.671875 7289972 19 42.503 1
- 65.625 7289972 19 43.503 1
- 61.81640625 7289973 19 40.448 -1
- 62.59765625 7289973 19 41.448 -1
- 63.671875 7289973 19 42.448 1
- 65.625 7289973 19 43.448 1
- def minus1_plus1_ratio(dictionary, new_df, step_df):
- dictionary[new_df] = dictionary[step_df].groupby(['ContextID', 'iso_forest']).size().reset_index(name='count')
- dictionary[new_df] = pd.pivot_table(dictionary[new_df], values = 'count', columns = ['iso_forest'],
- index = ['ContextID']).fillna(value = 0)
- dictionary[new_df]['-1/1'] = (dictionary[new_df][-1])/(dictionary[new_df][1])
- dictionary[new_df] = dictionary[new_df].sort_values(by = '-1/1', ascending = False)
- return dictionary[new_df]
- BacksGas_Flow_sccm ContextID StepID Time_Elapsed iso_forest
- 61.81640625 7289972 19 40.503 1
- 62.59765625 7289972 19 41.503 1
- 63.671875 7289972 19 42.503 1
- 65.625 7289972 19 43.503 1
- 61.81640625 7289973 19 40.448 1
- 62.59765625 7289973 19 41.448 1
- 63.671875 7289973 19 42.448 1
- 65.625 7289973 19 43.448 1
- dictionary[new_df]['-1/1'] = (dictionary[new_df][-1])/(dictionary[new_df][1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement