def initializeObjects(excelFileName, assets_list_start_column, assets_list_end_column): ''' Returns all objects needed for reallocation program ''' #### Import and parse the Excel file: #### ########################################## EXCEL_FILE_NAME = excelFileName EXCEL_HEADER_ROW_INDEX = 0 # This is the row number that has the names of the asset classes (cash, bonds, stock, etc.) dataframes = excel_import.importExcel( EXCEL_FILE_NAME, EXCEL_HEADER_ROW_INDEX) # Read the Excel file #### Create DataContainers for Sheets #### ###################################################################### ACCOUNTS_SHEET_NAME = "Accounts" currentAccounts = dc.DataContainer( dataframes[ACCOUNTS_SHEET_NAME] ) # Create a DataContainer for the 'accounts' worksheet TAX_SHEET = "Tax_Status" taxSheet = dc.DataContainer( dataframes[TAX_SHEET] ) # Create a DataContainer for the 'Tax_Status' worksheet SPECIAL_RULES_SHEET = "Other_inputs" specialRulesSheet = dc.DataContainer(dataframes[SPECIAL_RULES_SHEET]) DESIRED_ALLOCATION_SHEET_NAME = "Desired_Allocation" desiredAllocation = dc.DataContainer( dataframes[DESIRED_ALLOCATION_SHEET_NAME]) #### Create Account class Objects for currentAccounts Object #### ###################################################################### categoryList = currentAccounts.getHeaderNames( )[assets_list_start_column:assets_list_end_column] accounts = {} for account in currentAccounts.getRowNames(): owner = currentAccounts.getValue(account, 'Owner') institution = currentAccounts.getValue(account, 'Institution') account_type = currentAccounts.getValue(account, 'Account Type') assets = {} for category in categoryList: assets[category] = currentAccounts.getValue(account, category) accounts[account] = ac.Account(owner, institution, account_type, assets) return accounts
cropped_image = image return np.array(cropped_image) #------------------------------------------------------------------------------- # set paths DATA_PATH = # set path to celebA # download the Inception modelf from http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz MODEL_PATH = # set path to inception model # read N_IMGS data samples and store them in an data container print("Reading data...", end="", flush=True) data = glob( os.path.join( DATA_PATH,"*")) N_IMGS = 50; N_FEATURES = 64*64*3 X = dc.DataContainer(np.zeros((N_IMGS, N_FEATURES)), epoch_shuffle=True) for i in range(N_IMGS): img = get_image( data[i], input_height=64, input_width=64, resize_height=64, resize_width=64, is_crop=False, is_grayscale=False) X._data[i,:] = img.flatten() print("done") # load inference model fid.create_incpetion_graph(MODEL_PATH)
# brings us into /app. EXCEL_FILE_NAME = "../import_test.xlsx" EXCEL_HEADER_ROW_INDEX = 1 # This is the row number that has the names of the asset classes (cash, bonds, stock, etc.) dataframes = excel_import.importExcel( EXCEL_FILE_NAME, EXCEL_HEADER_ROW_INDEX) # Read the Excel file #### Print out certain data: #### ################################# ACCOUNTS_SHEET_NAME = "Accounts" # Show all of the data in the Accounts worksheet print dataframes[ACCOUNTS_SHEET_NAME] accounts = dc.DataContainer( dataframes[ACCOUNTS_SHEET_NAME] ) # Create a DataContainer for the 'accounts' worksheet ACCOUNT_NAME = "A1" ASSET_TYPE = "Cash/MMKT" cashForA1Account = accounts.getValue( ACCOUNT_NAME, ASSET_TYPE) # Get the amount of cash in the A1 account # print cashForA1Account CASH_ASSET_TYPE = "Cash/MMKT" BONDS_ASSET_TYPE = "Muni Bonds" cashAndBonds = accounts.getColumns( [CASH_ASSET_TYPE, BONDS_ASSET_TYPE]) # Get each account's amount in Cash and Bonds #print cashAndBonds
def accountsCopy(): ''' Return a copy of accounts DataContainer The copy will be used to store reallocation changes ''' return dc.DataContainer(dataframes[ACCOUNTS_SHEET_NAME])
""" #### Import and parse the Excel file: #### ########################################## EXCEL_FILE_NAME = "../Allocation_Template.xlsx" EXCEL_HEADER_ROW_INDEX = 0 # This is the row number that has the names of the asset classes (cash, bonds, stock, etc.) dataframes = excel_import.importExcel( EXCEL_FILE_NAME, EXCEL_HEADER_ROW_INDEX) # Read the Excel file #### Create DataContainers for Sheets #### ###################################################################### ACCOUNTS_SHEET_NAME = "Accounts" accounts = dc.DataContainer( dataframes[ACCOUNTS_SHEET_NAME] ) # Create a DataContainer for the 'accounts' worksheet TAX_SHEET = "Tax_Status" taxSheet = dc.DataContainer( dataframes[TAX_SHEET] ) # Create a DataContainer for the 'Tax_Status' worksheet SPECIAL_RULES_SHEET = "Other_inputs" specialRulesSheet = dc.DataContainer(dataframes[SPECIAL_RULES_SHEET]) DESIRED_ALLOCATION_SHEET_NAME = "Desired_Allocation" desiredAllocation = dc.DataContainer(dataframes[DESIRED_ALLOCATION_SHEET_NAME]) def accountsCopy():