Advertisement
Danila_lipatov

Untitled

Apr 22nd, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. def update_def(df_defaults: pd.DataFrame, df_check: pd.DataFrame, default_columns: str, checker_columns: str, time_def: str, time_check: str, rating: str):
  2. counter = 0
  3. for i in df_defaults.index:
  4. if df_defaults[default_columns][i] in df_check[checker_columns].values:
  5. temp_df = \
  6. df_check[df_check[checker_columns] == df_defaults[default_columns][i]].reset_index(drop=True).iloc[[0]]
  7. temp_df.at[0, rating] = 'D'
  8. temp_df.at[0, time_check] = df_defaults[time_def][i]
  9. # print(temp_df)
  10. df_check = pd.concat([df_check, temp_df], axis=0)
  11. counter += 1
  12.  
  13. return df_check
  14.  
  15. import numpy as np
  16. from scipy.linalg import expm
  17.  
  18. # to weighed avg pass more than 2 elem of slice_list
  19. # todo ignore value outdated?
  20. df_migration = df[[_ro_id, slice_column, _value_column]]
  21. df_migration.reset_index(drop=True, inplace=True) # todo check, outdated?
  22.  
  23. # pivot
  24. df_default = pd.DataFrame() #todo create df of defaults in any ways
  25. df_migration = update_def(df_default, df_migration, 'ogrn', _ro_id, 'time', slice_column, _value_column)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement