Contrasting Results
Contrast
Bases: dict
Source code in passengersim/contrast.py
__dir__
__getattr__
apply
apply(
func: Callable,
axis: int | Literal["index", "columns", "rows"] = 0,
warn_if_missing: bool = False,
) -> DataFrame | Series
Source code in passengersim/contrast.py
subset
Subset the contrast to only include the specified keys.
Parameters:
-
keys(str or list of str, default:None) –The keys to include in the subset. If None, use the
regexfilter. -
regex(str, default:None) –A regular expression to filter the keys. If None, use the
keysfilter.
Returns:
-
Contrast–
Source code in passengersim/contrast.py
MultiContrast
Bases: dict
Source code in passengersim/contrast.py
__dir__
__getattr__
Source code in passengersim/contrast.py
fig_bid_price_history
fig_bid_price_history(
summaries,
*,
by_carrier: bool | str = True,
show_stdev: float | bool | None = None,
cap: Literal["some", "zero", None] = None,
raw_df: bool = False,
title: str | None = "Bid Price History",
also_df: bool = False,
)
Source code in passengersim/contrast.py
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | |
fig_bookings_by_timeframe
fig_bookings_by_timeframe(
summaries: dict[str, SummaryTables],
by_carrier: bool | str = True,
by_class: bool | str = False,
*,
by_segment: str | None = None,
raw_df=False,
source_labels: bool = False,
ratio: str | bool = False,
also_df: bool = False,
) -> Chart | DataFrame
Generate a figure contrasting bookings by timeframe for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) –One or more SummaryTables to compare. The keys of this dictionary are the text names used to label the "source" for each set of data in the figure.
-
by_carrier(bool or str, default:True) –Whether to differentiate carriers by colors (the default) or give the name of a particular carrier as a string to filter the results shown in the figure to only that one carrier.
-
by_class(bool or str, default:False) –Whether to differentiate booking class by colors (the default) or give the name of a particular booking class as a string to filter the results shown in the figure to only that one booking class.
-
raw_df(bool, default:False) –Set to true to return the raw dataframe used to generate the figure, instead of the figure itself.
-
source_labels(bool, default:False) –Write source labels above the columns of the figure. Source labels are also available as tool tips, but if the figure is being shared as an image without tooltips, the source labels may make it easier to interpret.
-
ratio(str or bool, default:False) –Compute ratios against a reference point and display them in tooltips.
Other Parameters:
-
report(Reporter) –Giving a reporter for this keyword only argument allow you to automatically append this figure to the report (in addition to returning it for display or other processing).
-
trace(ExcelWriter or (ExcelWriter, str)) –Write the raw dataframe backing this figure to the Excel workbook.
Source code in passengersim/contrast.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
fig_carrier_load_factors
fig_carrier_load_factors(
summaries: dict[str, SummaryTables],
raw_df: bool = False,
load_measure: Literal[
"sys_lf", "avg_leg_lf"
] = "sys_lf",
orient: Literal["h", "v"] = "h",
ratio: str | bool = "all",
*,
width: int = 500,
also_df: bool = False,
title: str | None = "_default_",
)
Generate a figure contrasting carrier load factors for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) – -
raw_df(bool, default:False) – -
load_measure((sys_lf, avg_leg_lf), default:'sys_lf') – -
orient((h, v), default:'h') – -
ratio(bool or str, default:"all") –Add tooltip(s) giving the percentage change of each carrier's load factor to the load factor of the same carrier in the other summaries. Can be the key giving a specific summary to compare against, or 'all' to compare against all other summaries.
-
title(str, default:'_default_') –Title of the figure. Set to
Nonefor no title, otherwise a default title is used.
Returns:
-
Chart or DataFrame–
Source code in passengersim/contrast.py
fig_carrier_local_share
fig_carrier_local_share(
summaries,
load_measure: Literal[
"bookings", "leg_pax"
] = "bookings",
raw_df=False,
orient: Literal["h", "v"] = "h",
ratio: str | bool = "all",
*,
width: int = 500,
also_df: bool = False,
)
Generate a figure contrasting carrier local shares for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) – -
raw_df(bool, default:False) – -
orient((h, v), default:'h') – -
ratio(bool or str, default:True) –Add tooltip(s) giving the percentage change of each carrier's local share to the local share of the same carrier in the other summaries. Can be the key giving a specific summary to compare against, or 'all' to compare against all other summaries.
Returns:
-
Chart or DataFrame–
Source code in passengersim/contrast.py
fig_carrier_rasm
fig_carrier_rasm(
summaries,
raw_df=False,
orient: Literal["h", "v"] = "h",
ratio: str | bool = "all",
*,
width: int = 500,
also_df: bool = False,
)
Generate a figure contrasting carrier RASM for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) – -
raw_df(bool, default:False) – -
orient((h, v), default:'h') – -
ratio(bool or str, default:True) –Add tooltip(s) giving the percentage change of each carrier's yield to the yield of the same carrier in the other summaries. Can be the key giving a specific summary to compare against, or 'all' to compare against all other summaries.
Returns:
-
Chart or DataFrame–
Source code in passengersim/contrast.py
fig_carrier_revenues
fig_carrier_revenues(
summaries,
raw_df=False,
orient: Literal["h", "v"] = "h",
ratio: str | bool = "all",
*,
width: int = 500,
also_df: bool = False,
)
Generate a figure contrasting carrier revenues for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) – -
raw_df(bool, default:False) –Return only the raw data used to generate the figure.
-
orient((h, v), default:'h') – -
ratio(bool or str, default:True) –Add tooltip(s) giving the percentage change of each carrier's revenue to the revenue of the same carrier in the other summaries. Can be the key giving a specific summary to compare against, or 'all' to compare against all other summaries.
-
also_df(bool, default:False) –Return the raw data used to generate the figure in addition to the figure itself.
Returns:
-
Chart or DataFrame or tuple[Chart, DataFrame]–
Source code in passengersim/contrast.py
fig_carrier_total_bookings
fig_carrier_total_bookings(
summaries,
raw_df=False,
orient: Literal["h", "v"] = "h",
ratio: str | bool = "all",
*,
width: int = 500,
also_df: bool = False,
)
Generate a figure contrasting carrier total bookings for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) – -
raw_df(bool, default:False) – -
orient((h, v), default:'h') – -
ratio(bool or str, default:"all") –Add tooltip(s) giving the percentage change of each carrier's bookings to the bookings of the same carrier in the other summaries. Can be the key giving a specific summary to compare against, or 'all' to compare against all other summaries.
Returns:
-
Chart or DataFrame–
Source code in passengersim/contrast.py
fig_carrier_yields
fig_carrier_yields(
summaries,
raw_df=False,
orient: Literal["h", "v"] = "h",
ratio: str | bool = "all",
*,
width: int = 500,
also_df: bool = False,
)
Generate a figure contrasting carrier yields for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) – -
raw_df(bool, default:False) – -
orient((h, v), default:'h') – -
ratio(bool or str, default:True) –Add tooltip(s) giving the percentage change of each carrier's yield to the yield of the same carrier in the other summaries. Can be the key giving a specific summary to compare against, or 'all' to compare against all other summaries.
Returns:
-
Chart or DataFrame–
Source code in passengersim/contrast.py
fig_cp_segmentation
fig_cp_segmentation(
summaries: Contrast,
*,
raw_df: bool = False,
title: str | None = "Continuous Price Segmentation",
also_df: bool = False,
height: int = 600,
width: int = 300,
) -> Chart | tuple[Chart, DataFrame] | DataFrame
Generate a figure contrasting continuous price segmentation for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) –A dictionary of summary tables for different runs.
-
raw_df(bool, default:False) –If True, return the raw data used to generate the figure.
-
title(str, default:"Continuous Price Segmentation") –The title of the figure.
-
also_df(bool, default:False) –If True, return the raw data used to generate the figure in addition to the figure itself.
-
height(int, default:600) –The height of each facet panel of the figure, in pixels.
-
width(int, default:300) –The width of each facet panel of the figure, in pixels.
Returns:
-
Chart or tuple[Chart, DataFrame] or DataFrame–The generated Altair chart or the raw data used to generate the figure.
Source code in passengersim/contrast.py
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | |
fig_demand_to_come
fig_demand_to_come(
summaries: Contrast,
func: Literal["mean", "std"]
| list[Literal["mean", "std"]] = "mean",
*,
raw_df=False,
title: str | None = "Demand to Come",
also_df: bool = False,
)
Source code in passengersim/contrast.py
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 | |
fig_displacement_history
fig_displacement_history(
summaries,
*,
by_carrier: bool | str = True,
show_stdev: float | bool | None = None,
raw_df: bool = False,
title: str | None = "Displacement Cost History",
also_df: bool = False,
)
Source code in passengersim/contrast.py
fig_fare_class_mix
fig_fare_class_mix(
summaries,
*,
raw_df=False,
also_df: bool = False,
label_threshold: float = 0.06,
)
Source code in passengersim/contrast.py
fig_leg_forecasts
fig_leg_forecasts(
summaries,
raw_df=False,
by_leg_id=None,
by_class: bool | str = True,
of: Literal["mu", "sigma"]
| list[Literal["mu", "sigma"]] = "mu",
agg_booking_classes: bool = False,
also_df: bool = False,
)
Source code in passengersim/contrast.py
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | |
fig_path_forecasts
fig_path_forecasts(
summaries,
raw_df=False,
by_path_id=None,
path_names: dict | None = None,
agg_booking_classes: bool = False,
by_class: bool | str = True,
of: ForecastOfT | list[ForecastOfT] = "mu",
also_df: bool = False,
)
Source code in passengersim/contrast.py
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | |
fig_segmentation_by_timeframe
fig_segmentation_by_timeframe(
summaries: dict[str, SummaryTables],
metric: Literal["bookings", "revenue"],
by_carrier: bool | str = True,
by_class: bool | str = False,
raw_df=False,
source_labels: bool = False,
ratio: str | bool = False,
also_df: bool = False,
) -> Chart | DataFrame
Generate a figure contrasting segmentation by timeframe for one or more runs.
Parameters:
-
summaries(dict[str, SummaryTables]) –One or more SummaryTables to compare. The keys of this dictionary are the text names used to label the "source" for each set of data in the figure.
-
metric((bookings, revenue), default:'bookings') –The metric to display for the segmentation.
-
by_carrier(bool or str, default:True) –Whether to differentiate carriers by colors (the default) or give the name of a particular carrier as a string to filter the results shown in the figure to only that one carrier.
-
by_class(bool or str, default:False) –Whether to differentiate booking class by colors (the default) or give the name of a particular booking class as a string to filter the results shown in the figure to only that one booking class.
-
raw_df(bool, default:False) –Set to true to return the raw dataframe used to generate the figure, instead of the figure itself.
-
source_labels(bool, default:False) –Write source labels above the columns of the figure. Source labels are also available as tool tips, but if the figure is being shared as an image without tooltips, the source labels may make it easier to interpret.
-
ratio(str or bool, default:False) –Compute ratios against a reference point and display them in tooltips.
Other Parameters:
-
report(Reporter) –Giving a reporter for this keyword only argument allow you to automatically append this figure to the report (in addition to returning it for display or other processing).
-
trace(ExcelWriter or (ExcelWriter, str)) –Write the raw dataframe backing this figure to the Excel workbook.
Source code in passengersim/contrast.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |