Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- class FormulasCalculation:
- @staticmethod
- def _found_source_stock(row, df: pd.DataFrame):
- result_stocks = df.loc[
- (df['art_code_nm'] == row.art_code_nm) &
- (df['hub_nm'] == row.hub_nm)
- ]
- if not result_stocks.empty:
- return result_stocks.stock.tolist()[0]
- return 0 # TODO: bump
- @staticmethod
- def _found_destination_stock(row, df: pd.DataFrame):
- result_stocks = df.loc[
- (df['art_code_nm'] == row.art_code_nm) &
- (df['region_nm'] == row.hub_nm)
- ]
- if not result_stocks.empty:
- return result_stocks.stock.tolist()[0]
- return 0 # TODO: bump
- @staticmethod
- def _found_forecasts_region_sum_fc_1(row, df: pd.DataFrame):
- result_stocks = df.loc[
- (df['art_code_nm'] == row.art_code_nm) &
- (df['region_nm'] == row.region_nm)
- ]
- if not result_stocks.empty:
- return result_stocks.fc_1.tolist()[0]
- return 1111 # TODO: bump
- @staticmethod
- def _found_forecasts_hub_sum_fc_1(row, df: pd.DataFrame):
- result_stocks = df.loc[
- (df['art_code_nm'] == row.art_code_nm) &
- (df['hub_nm'] == row.hub_nm)
- ]
- if not result_stocks.empty:
- return result_stocks.fc_1.tolist()[0]
- return 1111 # TODO: bump
- @staticmethod
- def _found_sum_result_data_hub(row, df: pd.DataFrame):
- return 0 # TODO: bump
- @staticmethod
- def _found_sum_result_data_region(row, df: pd.DataFrame):
- return 0 # TODO: bump
- @staticmethod
- def _found_target_stock_hub(row, df: pd.DataFrame): # TODO: bump
- result_stocks = df.loc[
- (df['artcode_nm'] == row.art_code_nm) &
- (df['hub_nm'] == row.hub_nm)
- ]
- if not result_stocks.empty:
- return result_stocks.target_stock_hub.tolist()[0]
- return 1111 # TODO: bump
- @staticmethod
- def _found_target_stock_reg(row, df: pd.DataFrame): # TODO: bump
- result_stocks = df.loc[
- (df['artcode_nm'] == row.art_code_nm) &
- (df['region_nm'] == row.region_nm)
- ]
- if not result_stocks.empty:
- return result_stocks.target_stock_reg.tolist()[0]
- return 1111 # TODO: bump
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement