コード例 #1
0
ファイル: xl_io_wings.py プロジェクト: Imperat/make-xls-model
    row_indices.remove(variables['is_forecast'])

    for col, row in itertools.product(col_indices, row_indices):

        formula_dict = _get_formula(parsed_formulas, row, col)

        if formula_dict:
            dependent_variable_with_time_index = formula_dict['dependent_var']     # get expression for dependent variable, e.g. a(t)
            # dependent_variable_locations - values like {b(t): (8, 5)}
            dependent_variable_locations = simplify_expression(dependent_variable_with_time_index, col, variables)
            dv_key, dv_coords = dependent_variable_locations.popitem()

            # 2015-05-12 03:09 PM
            # --- Need to make this check elsewhere
            if dependent_variable_locations:
                raise ValueError('cannot have more than one dependent variable on left side of equation')
            # --- end

            # find excel type formula string
            right_side_expression = formula_dict['formula']
            formula_str = get_excel_formula_as_string(right_side_expression, col, variables)
            Range(get_sheet(), dv_coords).formula = formula_str                # Apply formula on excel cell

workfile = "D:/make-xls-model-master/spec.xls"
sheet = "model"
wb = Workbook(workfile)
Sheet(sheet).activate()
wb = get_workbook(workfile, sheet)
ar = _sample_for_xfill_array_after_equations()
Range(sheet, 'A1').value = ar
save_workbook(wb)	
コード例 #2
0
ファイル: xl_io_wings.py プロジェクト: Imperat/make-xls-model
def write_array_to_xlsx_using_xlwt(ar, xlsx_path, sheet_name):
    ar = _sample_for_xfill_array_after_equations()
    wb = Workbook(workfile)
    Sheet(sheet_name).activate()
    Range(sheet_name, 'A1').value = ar
コード例 #3
0
ファイル: xl_fill.py プロジェクト: Imperat/make-xls-model
def get_target_ar():
    from data_source import _sample_for_xfill_array_after_equations
    return _sample_for_xfill_array_after_equations()