leaf_engine.etl.fuel ==================== .. py:module:: leaf_engine.etl.fuel .. autoapi-nested-parse:: Shipment fuel calculations ========================== This module calculates fuel-related columns. The 'estimate...' functions can also be used directly in the mappings. Functions --------- .. autoapisummary:: leaf_engine.etl.fuel._get_fuel_price leaf_engine.etl.fuel.estimate_fuel_surcharge leaf_engine.etl.fuel.estimate_linehaul leaf_engine.etl.fuel.estimate_linehaul_zero_peg leaf_engine.etl.fuel.fuel_pipeline Module Contents --------------- .. py:function:: _get_fuel_price() -> pandas.DataFrame .. py:function:: estimate_fuel_surcharge(df: pandas.DataFrame, mileage: str = 'company_miles') -> pandas.Series :param df: shipments to operate on. Must contain: :param df['fuel_increment']: bucket/step size to hit for charge increase. :param df['charge_increment']: amount to raise the fuel charge. :returns: fuel surcharge column. :rtype: df['fuel_surcharge'] .. py:function:: estimate_linehaul(df: pandas.DataFrame) -> pandas.Series Calculates linehaul from spend, FSC, and accessorials. Args: df: with linehaul, spend, and FSC columns. Returns: df['linehaul']: linehaul column. .. py:function:: estimate_linehaul_zero_peg(df: pandas.DataFrame, mileage: str = 'company_miles') -> pandas.Series Calculates the baseline (zero peg) fuel costs baked into the linehaul. Subtracts those costs from the linehaul and saves the delta to 'linehaul_zero_peg'. Args: df: with linehaul, mileage, and fuel schedule columns. mileage: of the name of the column containing mileage (defaults to 'company_miles' at mapping stage, else uses 'pcm_miles'). Returns: df['linehaul_zero_peg']: linehaul_zero_peg column. .. py:function:: fuel_pipeline(df)