示例#1
0
def integrate_datasets(data_norm,
                       data_target,
                       path_xlsx_output,
                       integrator=None,
                       df_prepro=None,
                       df_norm=None):
    """
	Integrates the supplier dataset into the target schema.
	INPUT:
		- data_norm: preprocessed and normalised supplier dataset, must be in wide format
		- data_target: target dataset
		- path_xlsx_output: full path where to save the final xlsx file
	OUTPUT:
		- pandas dataframe
	"""
    if integrator is None:
        integrator = Integrator(path_normalised_file=None,
                                path_target_file=None,
                                path_prepro_file=None,
                                path_xlsx_output=path_xlsx_output,
                                path_integr_output=None)

    # renames the columns in the normalised dataframe so they can be appended to the target dataframe
    data = integrator.rename_columns(data_norm)

    # drops the columns in the normalised dataframe that have no match in the target dataframe
    data = integrator.drop_columns(data, data_target)

    # appends the supplier dataset to the target dataset
    data = integrator.append_supplier_to_target(data, data_target)

    # saves all the files in this task in one single xlsx file with each step in a different sheet
    integrator.save_xlsx(data, df_prepro=df_prepro, df_norm=df_norm)

    return data
示例#2
0
def main(path_normalised_file,
         path_target_file,
         path_prepro_file,
         path_xlsx_output,
         path_integr_output=None):
    # call object
    integr = Integrator(path_normalised_file=path_normalised_file,
                        path_target_file=path_target_file,
                        path_prepro_file=path_prepro_file,
                        path_xlsx_output=path_xlsx_output,
                        path_integr_output=path_integr_output)

    # load input dataframe
    data = integr.load_normalised()

    # load target dataframe
    data_target = integr.load_target()

    data = integrate_datasets(data_norm=data,
                              data_target=data_target,
                              path_xlsx_output=path_xlsx_output,
                              integrator=integr)

    # write output csv file
    if path_integr_output: data.to_csv(path_integr_output, index=True)
示例#3
0
def main():
    # Ingreso de datos
    h_max = float(input("Altura máxima de agua: "))
    h = float(input("Altura actual de agua: "))

    # Comprobar condiciones de la altura ingresada
    if (h < 0):
        h = 0  # h = 0 cuando este sea menor a 0
    elif (h > h_max):
        h = h_max  # h = h_max cuando h supere el limite

    integrator = Integrator(0, h)  #Clase integradora
    V = integrator.integrate()  #Se integra la funcion pi * x^2
    u = integrator.bisection(
        -1 * h, h, 1e-6
    )  #Algoritmo root-finding | Metodo de Bisección con tolerancia de 1e-6
    V_u = V + u  #Volumen total de la presa

    # FUNCION PARA DIBUJAR LA GRAFICA
    x = np.linspace(-5, 5, 100)
    plt.plot(x, integrator.function_value(x))
    plt.grid()

    # Valor del volumen cuando la altura es la máxima
    integrator_max = Integrator(0, h_max)
    v_max = integrator_max.integrate()

    # Comprobar si V(u) supera a V(h_max) entonces se vuelve
    # a realizar el calculo con u = h_max ó u = 0
    if (V_u > v_max):
        V_u = V + h_max

    if (V_u < 0):
        V_u = V

    # RESULTADOS
    print(f"V(u): {round(V_u, 5)}, V_max(h_max): {round(v_max,5)}")
    plt.show()
示例#4
0
order_id= uuid.uuid1()
comment1=" "
comment2=""


chromecast_unit_price = 150
chromecast_quantity = 2
chromecast_subtotal = chromecast_unit_price*chromecast_quantity

organza_unit_price = 50
organza_quantity = 2
organza_subtotal = organza_unit_price* organza_quantity


client = Integrator(namespace, wsdl, apiVersion, merchantEmail, merchantKey, serviceType, integrationMode)

chromecast = client.buildOrderItem("001", "chromecast", chromecast_unit_price, chromecast_quantity, chromecast_subtotal)
organza = client.buildOrderItem("002", "organza", organza_unit_price, organza_quantity,organza_subtotal)

order_items = client.buildAPIObject('ArrayOfOrderItem')

order_items.OrderItem.append(chromecast)
order_items.OrderItem.append(organza)

# print order_items
#
sub_total=chromecast_subtotal+ organza_subtotal
shipping_cost=30
tax_amount=0
total= sub_total + shipping_cost+ tax_amount