Advertisement
Mochinov

Untitled

May 18th, 2023
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. import pandas as pd
  2.  
  3.  
  4. class FormulasCalculation:
  5.  
  6.  
  7. @staticmethod
  8. def _found_source_stock(row, df: pd.DataFrame):
  9. result_stocks = df.loc[
  10. (df['art_code_nm'] == row.art_code_nm) &
  11. (df['hub_nm'] == row.hub_nm)
  12. ]
  13.  
  14. if not result_stocks.empty:
  15. return result_stocks.stock.tolist()[0]
  16.  
  17. return 0 # TODO: bump
  18.  
  19. @staticmethod
  20. def _found_destination_stock(row, df: pd.DataFrame):
  21. result_stocks = df.loc[
  22. (df['art_code_nm'] == row.art_code_nm) &
  23. (df['region_nm'] == row.hub_nm)
  24. ]
  25.  
  26. if not result_stocks.empty:
  27. return result_stocks.stock.tolist()[0]
  28.  
  29. return 0 # TODO: bump
  30.  
  31. @staticmethod
  32. def _found_forecasts_region_sum_fc_1(row, df: pd.DataFrame):
  33. result_stocks = df.loc[
  34. (df['art_code_nm'] == row.art_code_nm) &
  35. (df['region_nm'] == row.region_nm)
  36. ]
  37.  
  38. if not result_stocks.empty:
  39. return result_stocks.fc_1.tolist()[0]
  40.  
  41. return 1111 # TODO: bump
  42.  
  43. @staticmethod
  44. def _found_forecasts_hub_sum_fc_1(row, df: pd.DataFrame):
  45. result_stocks = df.loc[
  46. (df['art_code_nm'] == row.art_code_nm) &
  47. (df['hub_nm'] == row.hub_nm)
  48. ]
  49.  
  50. if not result_stocks.empty:
  51. return result_stocks.fc_1.tolist()[0]
  52.  
  53. return 1111 # TODO: bump
  54.  
  55. @staticmethod
  56. def _found_sum_result_data_hub(row, df: pd.DataFrame):
  57. return 0 # TODO: bump
  58.  
  59. @staticmethod
  60. def _found_sum_result_data_region(row, df: pd.DataFrame):
  61. return 0 # TODO: bump
  62.  
  63. @staticmethod
  64. def _found_target_stock_hub(row, df: pd.DataFrame): # TODO: bump
  65. result_stocks = df.loc[
  66. (df['artcode_nm'] == row.art_code_nm) &
  67. (df['hub_nm'] == row.hub_nm)
  68. ]
  69. if not result_stocks.empty:
  70. return result_stocks.target_stock_hub.tolist()[0]
  71.  
  72. return 1111 # TODO: bump
  73.  
  74. @staticmethod
  75. def _found_target_stock_reg(row, df: pd.DataFrame): # TODO: bump
  76. result_stocks = df.loc[
  77. (df['artcode_nm'] == row.art_code_nm) &
  78. (df['region_nm'] == row.region_nm)
  79. ]
  80.  
  81. if not result_stocks.empty:
  82. return result_stocks.target_stock_reg.tolist()[0]
  83.  
  84. return 1111 # TODO: bump
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement