leaf_engine.etl.fuel
This module calculates fuel-related columns. The ‘estimate…’ functions can also be used directly in the mappings.
Functions
|
|
|
|
|
Calculates linehaul from spend, FSC, and accessorials. |
|
Calculates the baseline (zero peg) fuel costs baked into the linehaul. |
|
Module Contents
- leaf_engine.etl.fuel._get_fuel_price() pandas.DataFrame
- Return type:
- leaf_engine.etl.fuel.estimate_fuel_surcharge(df: pandas.DataFrame, mileage: str = 'company_miles') pandas.Series
- Parameters:
df (pandas.DataFrame) – <DataFrame> shipments to operate on. Must contain:
df['fuel_increment'] – <float> bucket/step size to hit for charge increase.
df['charge_increment'] – <float> amount to raise the fuel charge.
mileage (str) –
- Returns:
<Series> fuel surcharge column.
- Return type:
df[‘fuel_surcharge’]
- leaf_engine.etl.fuel.estimate_linehaul(df: pandas.DataFrame) pandas.Series
Calculates linehaul from spend, FSC, and accessorials.
Args: df: <DataFrame> with linehaul, spend, and FSC columns.
Returns: df[‘linehaul’]: <Series> linehaul column.
- Parameters:
df (pandas.DataFrame) –
- Return type:
- leaf_engine.etl.fuel.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: <DataFrame> with linehaul, mileage, and fuel schedule columns. mileage: <String> of the name of the column containing mileage (defaults to ‘company_miles’ at mapping stage, else uses ‘pcm_miles’).
Returns: df[‘linehaul_zero_peg’]: <Series> linehaul_zero_peg column.
- Parameters:
df (pandas.DataFrame) –
mileage (str) –
- Return type:
- leaf_engine.etl.fuel.fuel_pipeline(df)