Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Attached Files: 2018_ICT112_assignment_passenger_movements.pdf XXXXXXXXXXKB) airline-passenger-movements.csv XXXXXXXXXXKB) 340104.csv XXXXXXXXXXKB) Description To produce a Python program that...

1 answer below »
Attached Files:
  • File2018_ICT112_assignment_passenger_movements.pdf XXXXXXXXXXKB)
  • Fileairline-passenger-movements.csv XXXXXXXXXXKB)
  • File340104.csv XXXXXXXXXXKB)
  • Description

    To produce a Python program that effectively solves a real-world problem.

    Here are thedetailed instructions and marking guidelinesfor this task.

    Resources

    Australian Passenger Movements Data

  • (right-click passenger_movements.csvand "Save As.." into your Task 2 Python folder)

Supplementary Data

  • (right-click 340104.csvand "Save As.." into your Task 2 Python folder) Click for more options
  • Note, this data is from (http://www.abs.gov.au/AUSSTATS/[email protected]/DetailsPage/3401.0Feb%202018?OpenDocument)
Answered Same Day May 25, 2020

Solution

Abr Writing answered on May 31 2020
136 Votes
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Generated Web Site for Aussie Airport Passenger Movements "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import json\n",
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Setting up the app/website using Flask, a web framework in Python"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from flask import Flask\n",
"app = Flask(__name__)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Setting various constants "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"IMAGES_FOLDER = 'Images'\n",
"INDEX_PAGE = '/'\n",
"TOTAL_PAX_PER_YEAR_PAGE = 'total-passengers-per-year.html'\n",
"TOTAL_PAX_PER_YEAR_PER_AIRPORT_PAGE = 'total-passengers-per-year-per-airport.html'\n",
"TOTAL_PAX_PER_YEAR_PER_STATE_PAGE = 'total-passengers-per-year-per-state.html'\n",
"RATE_OF_TOTAL_PAX_PER_YEAR_PER_STATE_PAGE = 'rate-of-total-passengers-per-year-per-state.html'\n",
"SEASONAL_PAX_PER_AIRPORT_PAGE = 'seasonal-passengers-per-year-per-airport.html'\n",
"SEASONAL_PAX_PER_STATE_PAGE ='seasonal-passengers-per-year-per-state.html'\n",
"TOURISTS_VS_RESIDENTS_PAGE = 'tourists-vs-residents-page.html'\n",
"\n",
"def create_folder(folder): \n",
" if not os.path.exists(folder):\n",
" os.makedirs(folder)\n",
" \n",
"create_folder(IMAGES_FOLDER)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Creating Visualizations"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('./1.csv', encoding = 'utf8')\n",
"\n",
"df2 = pd.read_csv('./2.csv', encoding = 'utf8')\n",
"df2 = df2.drop(df2.index[[0,1,2,3,4,5,6,7,8]])\n",
"df2 = df2.iloc[[0,1,2,3,4,5,6,7,8,9,10,11]].reset_index().drop('index',axis=1)\n",
"df2 = df2[['Number of movements ; Total (Country of stay
esidence) ; Short-term Visitors a
iving ;']]\n",
"df2.columns = ['Tourists']\n",
"df2 = df2.apply(pd.to_numeric)\n",
"\n",
"#creating dataframe with information per year per airport\n",
"dfg_airport = df.groupby(['AIRPORT','Year'])\n",
"df_airports = dfg_airport.aggregate(np.sum).reset_index()\n",
"df_airports = df_airports.drop('Month',axis=1)\n",
"\n",
"#creating a list of uniquire airport names\n",
"airports = df['AIRPORT'].unique()\n",
"\n",
"#creating a dictionary of states with their respective airports\n",
"states_dict = {\n",
" \"New South Wales\": [\"BALLINA\",\"SYDNEY\",\"CANBERRA\",\"NEWCASTLE\"],\n",
" \"Northern Te
itory\": [\"ALICE SPRINGS\",\"DARWIN\"],\n",
" \"Queensland\":[\"BRISBANE\",\"CAIRNS\",\"GOLD COAST\",\"HAMILTON ISLAND\",\"MACKAY\",\"ROCKHAMPTON\",\"SUNSHINE COAST\",\"TOWNSVILLE\"],\n",
" \"South Australia\":[\"ADELAIDE\"],\n",
" \"Tasmania\":[\"HOBART\",\"LAUNCESTON\"],\n",
" \"Vicoria\":[\"MELBOURNE\"],\n",
" \"Western Australia\":[\"KARRATHA\",\"PERTH\"],\n",
"}\n",
"\n",
"#creating a dictionary of states with their respective information dataframes\n",
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here