File size: 31,568 Bytes
9be4956 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 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 364 365 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 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "041c9721",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"data = pd.read_csv('/home/xj/toolAugEnv/code/toolConstraint/database/flights/Combined_Flights_2022.csv')\n",
"# df.to_csv('/home/xj/toolAugEnv/code/toolConstraint/database/flights/clean_Flights_2022.csv')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "03d0f39e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"FlightDate 2022-03-15\n",
"Airline Delta Air Lines Inc.\n",
"Origin LAS\n",
"Dest SLC\n",
"Cancelled False\n",
" ... \n",
"ArrDel15 0.0\n",
"ArrivalDelayGroups -2.0\n",
"ArrTimeBlk 1600-1659\n",
"DistanceGroup 2\n",
"DivAirportLandings 0\n",
"Name: 3504987, Length: 61, dtype: object"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data.iloc[3504987]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "036418f5",
"metadata": {},
"outputs": [],
"source": [
"data_dict = data.to_dict(orient = 'split')"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "ef12c4b3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"FlightDate 2022-01-29\n",
"Airline Frontier Airlines Inc.\n",
"Origin COS\n",
"Dest LAS\n",
"Cancelled False\n",
"Diverted False\n",
"CRSDepTime 1558\n",
"DepTime 1553.0\n",
"DepDelayMinutes 0.0\n",
"DepDelay -5.0\n",
"ArrTime 1646.0\n",
"ArrDelayMinutes 0.0\n",
"AirTime 91.0\n",
"CRSElapsedTime 124.0\n",
"ActualElapsedTime 113.0\n",
"Distance 604.0\n",
"Year 2022\n",
"Quarter 1\n",
"Month 1\n",
"DayofMonth 29\n",
"DayOfWeek 6\n",
"Marketing_Airline_Network F9\n",
"Operated_or_Branded_Code_Share_Partners F9\n",
"DOT_ID_Marketing_Airline 20436\n",
"IATA_Code_Marketing_Airline F9\n",
"Flight_Number_Marketing_Airline 2019\n",
"Operating_Airline F9\n",
"DOT_ID_Operating_Airline 20436\n",
"IATA_Code_Operating_Airline F9\n",
"Tail_Number N235FR\n",
"Flight_Number_Operating_Airline 2019\n",
"OriginAirportID 11109\n",
"OriginAirportSeqID 1110902\n",
"OriginCityMarketID 30189\n",
"OriginCityName Colorado Springs, CO\n",
"OriginState CO\n",
"OriginStateFips 8\n",
"OriginStateName Colorado\n",
"OriginWac 82\n",
"DestAirportID 12889\n",
"DestAirportSeqID 1288903\n",
"DestCityMarketID 32211\n",
"DestCityName Las Vegas, NV\n",
"DestState NV\n",
"DestStateFips 32\n",
"DestStateName Nevada\n",
"DestWac 85\n",
"DepDel15 0.0\n",
"DepartureDelayGroups -1.0\n",
"DepTimeBlk 1500-1559\n",
"TaxiOut 13.0\n",
"WheelsOff 1606.0\n",
"WheelsOn 1637.0\n",
"TaxiIn 9.0\n",
"CRSArrTime 1702\n",
"ArrDelay -16.0\n",
"ArrDel15 0.0\n",
"ArrivalDelayGroups -2.0\n",
"ArrTimeBlk 1700-1759\n",
"DistanceGroup 3\n",
"DivAirportLandings 0\n"
]
}
],
"source": [
"for idx,unit in enumerate(data_dict['columns']):\n",
" print(unit, data_dict['data'][3000020][idx])"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "372b3fd9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['2022-01-29',\n",
" 'Frontier Airlines Inc.',\n",
" 'COS',\n",
" 'LAS',\n",
" False,\n",
" False,\n",
" 1558,\n",
" 1553.0,\n",
" 0.0,\n",
" -5.0,\n",
" 1646.0,\n",
" 0.0,\n",
" 91.0,\n",
" 124.0,\n",
" 113.0,\n",
" 604.0,\n",
" 2022,\n",
" 1,\n",
" 1,\n",
" 29,\n",
" 6,\n",
" 'F9',\n",
" 'F9',\n",
" 20436,\n",
" 'F9',\n",
" 2019,\n",
" 'F9',\n",
" 20436,\n",
" 'F9',\n",
" 'N235FR',\n",
" 2019,\n",
" 11109,\n",
" 1110902,\n",
" 30189,\n",
" 'Colorado Springs, CO',\n",
" 'CO',\n",
" 8,\n",
" 'Colorado',\n",
" 82,\n",
" 12889,\n",
" 1288903,\n",
" 32211,\n",
" 'Las Vegas, NV',\n",
" 'NV',\n",
" 32,\n",
" 'Nevada',\n",
" 85,\n",
" 0.0,\n",
" -1.0,\n",
" '1500-1559',\n",
" 13.0,\n",
" 1606.0,\n",
" 1637.0,\n",
" 9.0,\n",
" 1702,\n",
" -16.0,\n",
" 0.0,\n",
" -2.0,\n",
" '1700-1759',\n",
" 3,\n",
" 0]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_dict['data'][3000020]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "371a85fd",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4078318\n"
]
}
],
"source": [
"print(len(data_dict['data']))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "64d46483",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"FlightDate 0\n",
"DepTime 7\n",
"ArrTime 10\n",
"ActualElapsedTime 14\n",
"Distance 15\n",
"OriginCityName 34\n",
"DestCityName 42\n"
]
}
],
"source": [
"for idx,unit in enumerate(data_dict['columns']):\n",
" if unit in ['FlightDate','DepTime','ArrTime','ActualElapsedTime','Distance','OriginCityName','DestCityName']:\n",
" print(unit, str(idx))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "81047adf",
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"def convert_to_hhmm(time_float):\n",
" \"\"\"\n",
" Convert a float time to hh:mm format\n",
" :param time_float: Time as a float. Example: 757.0\n",
" :return: Time in hh:mm format. Example: \"07:57\"\n",
" \"\"\"\n",
" try:\n",
" hours = int(time_float // 100)\n",
" minutes = int(time_float % 100)\n",
" return \"{:02d}:{:02d}\".format(hours, minutes)\n",
" except:\n",
" return time_float\n",
"\n",
"def minutes_to_hours_minutes(minutes):\n",
" # Check for NaN and handle it\n",
" if math.isnan(minutes):\n",
" return \"NaN\"\n",
" \n",
" # Ensure minutes is an integer or rounded to the nearest integer\n",
" minutes = round(minutes)\n",
" \n",
" hours = minutes // 60\n",
" remaining_minutes = minutes % 60\n",
" return f\"{hours} hours {remaining_minutes} minutes\""
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "ee34cbde",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b60c3d13fb6d44258103c6251365272b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"0it [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from tqdm.autonotebook import tqdm\n",
"import random\n",
"new_data = []\n",
"for idx, unit in tqdm(enumerate(data_dict['data'])):\n",
" tmp_dict = {k:\"\" for k in ['FlightDate','DepTime','ArrTime','ActualElapsedTime','Distance','OriginCityName','DestCityName','Price']}\n",
" tmp_dict['FlightDate'] = unit[0]\n",
" tmp_dict['DepTime'] = convert_to_hhmm(unit[7])\n",
" tmp_dict['ArrTime'] = convert_to_hhmm(unit[10])\n",
" tmp_dict['ActualElapsedTime'] = minutes_to_hours_minutes(unit[14])\n",
" tmp_dict['Distance'] = unit[15]\n",
" tmp_dict['OriginCityName'] = unit[34].split(',')[0].split('/')[0]\n",
" tmp_dict['DestCityName'] = unit[42].split(',')[0].split('/')[0]\n",
" tmp_dict['Price'] = int((unit[15]) * random.uniform(0.2,0.5))\n",
" new_data.append(tmp_dict)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "aee3f422",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'FlightDate': '2022-01-29',\n",
" 'DepTime': '15:53',\n",
" 'ArrTime': '16:46',\n",
" 'ActualElapsedTime': '1 hours 53 minutes',\n",
" 'Distance': 604.0,\n",
" 'OriginCityName': 'Colorado Springs',\n",
" 'DestCityName': 'Las Vegas',\n",
" 'Price': 205}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_data[3000020]"
]
},
{
"cell_type": "code",
"execution_count": 90,
"id": "bfb243c0",
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame(new_data)"
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "f152a150",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>FlightDate</th>\n",
" <th>DepTime</th>\n",
" <th>ArrTime</th>\n",
" <th>ActualElapsedTime</th>\n",
" <th>Distance</th>\n",
" <th>OriginCityName</th>\n",
" <th>DestCityName</th>\n",
" <th>Price</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>3488394</th>\n",
" <td>2022-03-01</td>\n",
" <td>07:24</td>\n",
" <td>15:15</td>\n",
" <td>4 hours 51 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>720</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3509382</th>\n",
" <td>2022-03-01</td>\n",
" <td>22:29</td>\n",
" <td>06:07</td>\n",
" <td>4 hours 38 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>484</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3736056</th>\n",
" <td>2022-03-01</td>\n",
" <td>23:33</td>\n",
" <td>07:16</td>\n",
" <td>4 hours 43 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>1199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3736260</th>\n",
" <td>2022-03-01</td>\n",
" <td>14:37</td>\n",
" <td>22:05</td>\n",
" <td>4 hours 28 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>950</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3736313</th>\n",
" <td>2022-03-01</td>\n",
" <td>09:11</td>\n",
" <td>17:17</td>\n",
" <td>5 hours 6 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>1050</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3776858</th>\n",
" <td>2022-03-01</td>\n",
" <td>21:01</td>\n",
" <td>04:32</td>\n",
" <td>4 hours 31 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>1146</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3778565</th>\n",
" <td>2022-03-01</td>\n",
" <td>13:18</td>\n",
" <td>21:08</td>\n",
" <td>4 hours 50 minutes</td>\n",
" <td>2422.0</td>\n",
" <td>Seattle</td>\n",
" <td>New York</td>\n",
" <td>578</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" FlightDate DepTime ArrTime ActualElapsedTime Distance \n",
"3488394 2022-03-01 07:24 15:15 4 hours 51 minutes 2422.0 \\\n",
"3509382 2022-03-01 22:29 06:07 4 hours 38 minutes 2422.0 \n",
"3736056 2022-03-01 23:33 07:16 4 hours 43 minutes 2422.0 \n",
"3736260 2022-03-01 14:37 22:05 4 hours 28 minutes 2422.0 \n",
"3736313 2022-03-01 09:11 17:17 5 hours 6 minutes 2422.0 \n",
"3776858 2022-03-01 21:01 04:32 4 hours 31 minutes 2422.0 \n",
"3778565 2022-03-01 13:18 21:08 4 hours 50 minutes 2422.0 \n",
"\n",
" OriginCityName DestCityName Price \n",
"3488394 Seattle New York 720 \n",
"3509382 Seattle New York 484 \n",
"3736056 Seattle New York 1199 \n",
"3736260 Seattle New York 950 \n",
"3736313 Seattle New York 1050 \n",
"3776858 Seattle New York 1146 \n",
"3778565 Seattle New York 578 "
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[(df['OriginCityName']=='Seattle') & (df['DestCityName']=='New York')& (df['FlightDate']=='2022-03-01')]"
]
},
{
"cell_type": "code",
"execution_count": 92,
"id": "9f85d8e6",
"metadata": {},
"outputs": [],
"source": [
"df['Flight Number'] = df.index"
]
},
{
"cell_type": "code",
"execution_count": 93,
"id": "045df94c",
"metadata": {},
"outputs": [],
"source": [
"df = df.reset_index(drop=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4e1b68b7",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 91,
"id": "5c7d3b44",
"metadata": {},
"outputs": [],
"source": [
"df.index = df.index.map(lambda x: str(x).zfill(7))"
]
},
{
"cell_type": "code",
"execution_count": 94,
"id": "7a1f223c",
"metadata": {},
"outputs": [],
"source": [
"df['Flight Number'] = 'F' + df['Flight Number'].astype(str)"
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "af7e3411",
"metadata": {},
"outputs": [],
"source": [
"df.to_csv('/home/xj/toolAugEnv/code/toolConstraint/database/flights/clean_Flights_2022.csv')"
]
},
{
"cell_type": "code",
"execution_count": 95,
"id": "461e83ef",
"metadata": {},
"outputs": [],
"source": [
"x = df[df['OriginCityName']=='Montrose']"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "ed4e2107",
"metadata": {},
"outputs": [],
"source": [
"x = df[df['DestCityName']=='Montrose']"
]
},
{
"cell_type": "code",
"execution_count": 96,
"id": "56c918e3",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>FlightDate</th>\n",
" <th>DepTime</th>\n",
" <th>ArrTime</th>\n",
" <th>ActualElapsedTime</th>\n",
" <th>Distance</th>\n",
" <th>OriginCityName</th>\n",
" <th>DestCityName</th>\n",
" <th>Price</th>\n",
" <th>Flight Number</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>4155</th>\n",
" <td>2022-04-01</td>\n",
" <td>10:42</td>\n",
" <td>11:34</td>\n",
" <td>0 hours 52 minutes</td>\n",
" <td>196.0</td>\n",
" <td>Montrose</td>\n",
" <td>Denver</td>\n",
" <td>42</td>\n",
" <td>F0004155</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4156</th>\n",
" <td>2022-04-01</td>\n",
" <td>14:43</td>\n",
" <td>15:32</td>\n",
" <td>0 hours 49 minutes</td>\n",
" <td>196.0</td>\n",
" <td>Montrose</td>\n",
" <td>Denver</td>\n",
" <td>64</td>\n",
" <td>F0004156</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4157</th>\n",
" <td>2022-04-01</td>\n",
" <td>17:38</td>\n",
" <td>18:58</td>\n",
" <td>1 hours 20 minutes</td>\n",
" <td>196.0</td>\n",
" <td>Montrose</td>\n",
" <td>Denver</td>\n",
" <td>97</td>\n",
" <td>F0004157</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7439</th>\n",
" <td>2022-04-02</td>\n",
" <td>13:38</td>\n",
" <td>16:32</td>\n",
" <td>1 hours 54 minutes</td>\n",
" <td>733.0</td>\n",
" <td>Montrose</td>\n",
" <td>Dallas</td>\n",
" <td>151</td>\n",
" <td>F0007439</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7440</th>\n",
" <td>2022-04-02</td>\n",
" <td>12:37</td>\n",
" <td>13:29</td>\n",
" <td>0 hours 52 minutes</td>\n",
" <td>196.0</td>\n",
" <td>Montrose</td>\n",
" <td>Denver</td>\n",
" <td>54</td>\n",
" <td>F0007440</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4045139</th>\n",
" <td>2022-03-27</td>\n",
" <td>11:50</td>\n",
" <td>12:17</td>\n",
" <td>1 hours 27 minutes</td>\n",
" <td>419.0</td>\n",
" <td>Montrose</td>\n",
" <td>Phoenix</td>\n",
" <td>133</td>\n",
" <td>F4045139</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4045140</th>\n",
" <td>2022-03-28</td>\n",
" <td>11:45</td>\n",
" <td>12:22</td>\n",
" <td>1 hours 37 minutes</td>\n",
" <td>419.0</td>\n",
" <td>Montrose</td>\n",
" <td>Phoenix</td>\n",
" <td>188</td>\n",
" <td>F4045140</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4045141</th>\n",
" <td>2022-03-29</td>\n",
" <td>11:35</td>\n",
" <td>12:17</td>\n",
" <td>1 hours 42 minutes</td>\n",
" <td>419.0</td>\n",
" <td>Montrose</td>\n",
" <td>Phoenix</td>\n",
" <td>144</td>\n",
" <td>F4045141</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4045142</th>\n",
" <td>2022-03-30</td>\n",
" <td>11:38</td>\n",
" <td>12:13</td>\n",
" <td>1 hours 35 minutes</td>\n",
" <td>419.0</td>\n",
" <td>Montrose</td>\n",
" <td>Phoenix</td>\n",
" <td>125</td>\n",
" <td>F4045142</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4045143</th>\n",
" <td>2022-03-31</td>\n",
" <td>11:40</td>\n",
" <td>12:19</td>\n",
" <td>1 hours 39 minutes</td>\n",
" <td>419.0</td>\n",
" <td>Montrose</td>\n",
" <td>Phoenix</td>\n",
" <td>129</td>\n",
" <td>F4045143</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>2035 rows × 9 columns</p>\n",
"</div>"
],
"text/plain": [
" FlightDate DepTime ArrTime ActualElapsedTime Distance \n",
"4155 2022-04-01 10:42 11:34 0 hours 52 minutes 196.0 \\\n",
"4156 2022-04-01 14:43 15:32 0 hours 49 minutes 196.0 \n",
"4157 2022-04-01 17:38 18:58 1 hours 20 minutes 196.0 \n",
"7439 2022-04-02 13:38 16:32 1 hours 54 minutes 733.0 \n",
"7440 2022-04-02 12:37 13:29 0 hours 52 minutes 196.0 \n",
"... ... ... ... ... ... \n",
"4045139 2022-03-27 11:50 12:17 1 hours 27 minutes 419.0 \n",
"4045140 2022-03-28 11:45 12:22 1 hours 37 minutes 419.0 \n",
"4045141 2022-03-29 11:35 12:17 1 hours 42 minutes 419.0 \n",
"4045142 2022-03-30 11:38 12:13 1 hours 35 minutes 419.0 \n",
"4045143 2022-03-31 11:40 12:19 1 hours 39 minutes 419.0 \n",
"\n",
" OriginCityName DestCityName Price Flight Number \n",
"4155 Montrose Denver 42 F0004155 \n",
"4156 Montrose Denver 64 F0004156 \n",
"4157 Montrose Denver 97 F0004157 \n",
"7439 Montrose Dallas 151 F0007439 \n",
"7440 Montrose Denver 54 F0007440 \n",
"... ... ... ... ... \n",
"4045139 Montrose Phoenix 133 F4045139 \n",
"4045140 Montrose Phoenix 188 F4045140 \n",
"4045141 Montrose Phoenix 144 F4045141 \n",
"4045142 Montrose Phoenix 125 F4045142 \n",
"4045143 Montrose Phoenix 129 F4045143 \n",
"\n",
"[2035 rows x 9 columns]"
]
},
"execution_count": 96,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "74dfd3cd",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>FlightDate</th>\n",
" <th>DepTime</th>\n",
" <th>ArrTime</th>\n",
" <th>ActualElapsedTime</th>\n",
" <th>Distance</th>\n",
" <th>OriginCityName</th>\n",
" <th>DestCityName</th>\n",
" <th>Price</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1369</th>\n",
" <td>2022-04-01</td>\n",
" <td>09:04</td>\n",
" <td>10:23</td>\n",
" <td>1 hours 19 minutes</td>\n",
" <td>229.0</td>\n",
" <td>Washington</td>\n",
" <td>New York</td>\n",
" <td>105</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1370</th>\n",
" <td>2022-04-01</td>\n",
" <td>11:07</td>\n",
" <td>12:29</td>\n",
" <td>1 hours 22 minutes</td>\n",
" <td>229.0</td>\n",
" <td>Washington</td>\n",
" <td>New York</td>\n",
" <td>56</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1380</th>\n",
" <td>2022-04-01</td>\n",
" <td>13:20</td>\n",
" <td>14:52</td>\n",
" <td>1 hours 32 minutes</td>\n",
" <td>229.0</td>\n",
" <td>Washington</td>\n",
" <td>New York</td>\n",
" <td>95</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1409</th>\n",
" <td>2022-04-01</td>\n",
" <td>19:03</td>\n",
" <td>20:23</td>\n",
" <td>1 hours 20 minutes</td>\n",
" <td>229.0</td>\n",
" <td>Washington</td>\n",
" <td>New York</td>\n",
" <td>71</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1436</th>\n",
" <td>2022-04-01</td>\n",
" <td>15:32</td>\n",
" <td>17:03</td>\n",
" <td>1 hours 31 minutes</td>\n",
" <td>229.0</td>\n",
" <td>Washington</td>\n",
" <td>New York</td>\n",
" <td>64</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>565444</th>\n",
" <td>2022-04-01</td>\n",
" <td>22:55</td>\n",
" <td>07:09</td>\n",
" <td>5 hours 14 minutes</td>\n",
" <td>2475.0</td>\n",
" <td>Los Angeles</td>\n",
" <td>New York</td>\n",
" <td>621</td>\n",
" </tr>\n",
" <tr>\n",
" <th>565446</th>\n",
" <td>2022-04-01</td>\n",
" <td>11:39</td>\n",
" <td>19:49</td>\n",
" <td>5 hours 10 minutes</td>\n",
" <td>2475.0</td>\n",
" <td>Los Angeles</td>\n",
" <td>New York</td>\n",
" <td>1100</td>\n",
" </tr>\n",
" <tr>\n",
" <th>565511</th>\n",
" <td>2022-04-01</td>\n",
" <td>15:48</td>\n",
" <td>22:16</td>\n",
" <td>4 hours 28 minutes</td>\n",
" <td>1620.0</td>\n",
" <td>Denver</td>\n",
" <td>New York</td>\n",
" <td>575</td>\n",
" </tr>\n",
" <tr>\n",
" <th>565541</th>\n",
" <td>2022-04-01</td>\n",
" <td>17:36</td>\n",
" <td>23:05</td>\n",
" <td>3 hours 29 minutes</td>\n",
" <td>1620.0</td>\n",
" <td>Denver</td>\n",
" <td>New York</td>\n",
" <td>669</td>\n",
" </tr>\n",
" <tr>\n",
" <th>565581</th>\n",
" <td>2022-04-01</td>\n",
" <td>20:52</td>\n",
" <td>23:48</td>\n",
" <td>1 hours 56 minutes</td>\n",
" <td>733.0</td>\n",
" <td>Chicago</td>\n",
" <td>New York</td>\n",
" <td>338</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>889 rows × 8 columns</p>\n",
"</div>"
],
"text/plain": [
" FlightDate DepTime ArrTime ActualElapsedTime Distance \n",
"1369 2022-04-01 09:04 10:23 1 hours 19 minutes 229.0 \\\n",
"1370 2022-04-01 11:07 12:29 1 hours 22 minutes 229.0 \n",
"1380 2022-04-01 13:20 14:52 1 hours 32 minutes 229.0 \n",
"1409 2022-04-01 19:03 20:23 1 hours 20 minutes 229.0 \n",
"1436 2022-04-01 15:32 17:03 1 hours 31 minutes 229.0 \n",
"... ... ... ... ... ... \n",
"565444 2022-04-01 22:55 07:09 5 hours 14 minutes 2475.0 \n",
"565446 2022-04-01 11:39 19:49 5 hours 10 minutes 2475.0 \n",
"565511 2022-04-01 15:48 22:16 4 hours 28 minutes 1620.0 \n",
"565541 2022-04-01 17:36 23:05 3 hours 29 minutes 1620.0 \n",
"565581 2022-04-01 20:52 23:48 1 hours 56 minutes 733.0 \n",
"\n",
" OriginCityName DestCityName Price \n",
"1369 Washington New York 105 \n",
"1370 Washington New York 56 \n",
"1380 Washington New York 95 \n",
"1409 Washington New York 71 \n",
"1436 Washington New York 64 \n",
"... ... ... ... \n",
"565444 Los Angeles New York 621 \n",
"565446 Los Angeles New York 1100 \n",
"565511 Denver New York 575 \n",
"565541 Denver New York 669 \n",
"565581 Chicago New York 338 \n",
"\n",
"[889 rows x 8 columns]"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x[x['FlightDate']=='2022-04-01']"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "93c2a26f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Manhattan', 'Ft. Riley']\n"
]
}
],
"source": [
"print('Manhattan/Ft. Riley'.split('/'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86b394bf",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|