|
|
|
@ -95,11 +95,11 @@ def expected_value(row, price_pos_abs=200, price_neg_abs=100, price_pos_perc=0.0 |
|
|
|
|
expcachetime = incachetime |
|
|
|
|
if equal_price(inprice, outprice): |
|
|
|
|
if pd.isnull(incachetime): |
|
|
|
|
return 3 |
|
|
|
|
return 4 |
|
|
|
|
modifier = 1 |
|
|
|
|
|
|
|
|
|
if pd.isnull(incachetime): |
|
|
|
|
return 1 |
|
|
|
|
return 2 |
|
|
|
|
|
|
|
|
|
if expcachetime <= np.timedelta64(12,'h'): |
|
|
|
|
return 1 + modifier |
|
|
|
@ -116,18 +116,21 @@ def expected_value(row, price_pos_abs=200, price_neg_abs=100, price_pos_perc=0.0 |
|
|
|
|
|
|
|
|
|
return min(7, 7 + modifier) |
|
|
|
|
|
|
|
|
|
def fromisoformat(s): |
|
|
|
|
return dt.datetime.strptime(s, '%Y-%m-%dT%H:%M:%S') |
|
|
|
|
|
|
|
|
|
def compute_duration(row): |
|
|
|
|
indeparture, outdeparture = row['flight.inboundSegments.departure'], row['flight.outboundSegments.departure'] |
|
|
|
|
if pd.isna(indeparture): |
|
|
|
|
return 0 |
|
|
|
|
else: |
|
|
|
|
indt = dt.datetime.fromisoformat(indeparture.split('|')[0]) |
|
|
|
|
outdt = dt.datetime.fromisoformat(outdeparture.split('|')[0]) |
|
|
|
|
indt = fromisoformat(indeparture.split('|')[0]) |
|
|
|
|
outdt = fromisoformat(outdeparture.split('|')[0]) |
|
|
|
|
return (indt - outdt).days |
|
|
|
|
|
|
|
|
|
def compute_prebooking(row): |
|
|
|
|
tstamp, outdeparture = row['timestamp'], row['flight.outboundSegments.departure'] |
|
|
|
|
outdt = dt.datetime.fromisoformat(outdeparture.split('|')[0]) |
|
|
|
|
outdt = fromisoformat(outdeparture.split('|')[0]) |
|
|
|
|
return (outdt - tstamp).days |
|
|
|
|
|
|
|
|
|
def preprocess_data(df): |
|
|
|
|