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

# 1001 EXTREMELY BASICnum1 = int(input("num1"))num2 = int(input("num2"))answer = num1 + num2print("total = {} + {} = {}".format(num1,num2,answer)) #AREA OF CIRCLER = int(input("R"))n = 3.14159A =...

1 answer below ยป
# 1001 EXTREMELY BASICnum1 = int(input("num1"))num2 = int(input("num2"))answer = num1 + num2print("total = {} + {} = {}".format(num1,num2,answer))


#AREA OF CIRCLER = int(input("R"))n = 3.14159A = n*R**2print("A = {} . {} = {}".format(R,n,A))


# SIMPLE PRODUCTnum1 = int(input("num1"))num2 = int(input("num2"))prod = num1 * num2print("prod = {} * {} = {}".format(num1,num2,prod))


#SPHERER = int(input("R"))pi = 3.14159volume =(4/3)*pi*R**3print("volume = {} . {} = {}".format(R,pi,volume))


#DIFFERENCEA = int(input("A"))B = int(input("B"))C = int(input("C"))D = int(input("D"))diferenca = (A*B-C*D)print("diferenca = {}*{} - {}*{}= {}".format(A,B,C,D,diferenca))
Answered Same Day Jun 03, 2020 ICT112 University of the Sunshine Coast

Solution

Abr Writing answered on Jun 06 2020
111 Votes
ICT112 Assignment.ipyn
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Generated Web Site for Aussie Airport Passenger Movements
cente
"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\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 various constants "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def Constants():\n",
" global HTML_FOLDER \n",
" global IMAGES_FOLDER\n",
" global INDEX_PAGE \n",
" global TOTAL_PAX_PER_YEAR_PAGE\n",
" global TOTAL_PAX_PER_YEAR_PER_AIRPORT_PAGE\n",
" global TOTAL_PAX_PER_YEAR_PER_STATE_PAGE\n",
" global RATE_OF_TOTAL_PAX_PER_YEAR_PER_STATE_PAGE\n",
" global SEASONAL_PAX_PER_AIRPORT_PAGE\n",
" global SEASONAL_PAX_PER_STATE_PAGE\n",
" global TOURISTS_VS_RESIDENTS_PAGE \n",
" \n",
" \n",
" HTML_FOLDER = 'HTML'\n",
" IMAGES_FOLDER = 'Images'\n",
" INDEX_PAGE = 'index.htm'\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",
"\n",
" if not os.path.exists(folder):\n",
" os.makedirs(folder)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Creating Visualizations"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def Visualizations(filehandle1, filehandle2): \n",
" df = pd.read_csv(filehandle1, encoding = 'utf8')\n",
"\n",
" df2 = pd.read_csv(filehandle2, 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",
" global airports\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",
" global df_states_dict\n",
" df_states_dict = {}\n",
" for state in states_dict:\n",
" df_states_dict[state] = df_airports[df_airports['AIRPORT'].isin(states_dict[state])].drop('AIRPORT',axis=1)\n",
" df_states_dict[state] = df_states_dict[state].groupby(['Year']).aggregate(np.sum).reset_index()\n",
"\n",
" #creating seasonal dataframes per airport \n",
" df_summer = df[df['Month'].isin([12,1,2])].drop('Month',axis=1).groupby(['AIRPORT','Year']).aggregate(np.sum).reset_index()\n",
" df_winter = df[df['Month'].isin([6,7,8])].drop('Month',axis=1).groupby(['AIRPORT','Year']).aggregate(np.sum).reset_index()\n",
"\n",
" #creating dictionaries of states with their respective seasonal information dataframes\n",
" df_states_summer_dict = {}\n",
" for state in states_dict:\n",
" df_states_summer_dict[state] = df_summer[df_summer['AIRPORT'].isin(states_dict[state])].drop('AIRPORT',axis=1)\n",
" df_states_summer_dict[state] = df_states_summer_dict[state].groupby(['Year']).aggregate(np.sum).reset_index() \n",
" df_states_winter_dict = {}\n",
" for state in states_dict:\n",
" df_states_winter_dict[state] = df_winter[df_winter['AIRPORT'].isin(states_dict[state])].drop('AIRPORT',axis=1)\n",
" df_states_winter_dict[state] = df_states_winter_dict[state].groupby(['Year']).aggregate(np.sum).reset_index()\n",
"\n",
" #creating dataframe for year 1991 and processing information about tourists and residents\n",
" df_1991 = df[(df['AIRPORT']=='All Australian Airports') & (df['Year']==1991)].reset_index().drop('index',axis=1).join(df2)\n",
" df_1991['Permanaent Residents'] = df_1991.apply(lambda row: row[6] - row[12] ,axis=1)\n",
"\n",
"\n",
" for airport in airports:\n",
" pax_total_df = df_airports[df_airports['AIRPORT']==airport]\n",
" pax_total_df.plot(x='Year', title = airport)\n",
" plt.savefig('./'+IMAGES_FOLDER+'/'+airport+'_pax_total.png')\n",
" plt.close() \n",
"\n",
" for state in states_dict:\n",
" state_df = df_states_dict[state]\n",
" state_df.plot(x='Year', title = state)\n",
" plt.savefig('./'+IMAGES_FOLDER+'/'+state+'_pax_total.png')\n",
" plt.close()\n",
"\n",
" for airport in airports:\n",
" winter_pax_total_df = df_winter[df_winter['AIRPORT']==airport]\n",
" winter_pax_total_df.plot(x='Year', title = airport+' - Winter') \n",
" plt.savefig('./'+IMAGES_FOLDER+'/'+airport+'_winter_pax_total.png')\n",
" plt.close()\n",
"\n",
" summer_pax_total_df = df_summer[df_summer['AIRPORT']==airport]\n",
" summer_pax_total_df.plot(x='Year', title = airport+ ' - Summer')\n",
" plt.savefig('./'+IMAGES_FOLDER+'/'+airport+'_summer_pax_total.png')\n",
" plt.close()\n",
"\n",
" for state in states_dict:\n",
" winter_pax_total_df = df_states_winter_dict[state]\n",
" winter_pax_total_df.plot(x='Year', title = state+' - Winter') \n",
" plt.savefig('./'+IMAGES_FOLDER+'/'+state+'_winter_pax_total.png')\n",
" plt.close()\n",
"\n",
" summer_pax_total_df = df_states_summer_dict[state]\n",
" summer_pax_total_df.plot(x='Year', title = state+ ' - Summer')\n",
" plt.savefig('./'+IMAGES_FOLDER+'/'+state+'_summer_pax_total.png')\n",
" plt.close()\n",
"\n",
" df_1991_summer = df_1991.iloc[[11,0,1]].drop('Month',axis=1).groupby(['AIRPORT','Year']).aggregate(np.sum).reset_index()\n",
" df_1991_summer.plot(y=['Int_Pax_In','Tourists','Permanaent Residents'],kind='bar', title = 'Tourists Vs Residents - 1991 Summer')\n",
" plt.savefig('./'+IMAGES_FOLDER+'/tourists_vs_residents_summer.png')\n",
" plt.close()\n",
"\n",
" df_1991_summer = df_1991.iloc[[5,6,7]].drop('Month',axis=1).groupby(['AIRPORT','Year']).aggregate(np.sum).reset_index()\n",
" df_1991_summer.plot(y=['Int_Pax_In','Tourists','Permanaent Residents'],kind='bar', title = 'Tourists Vs Residents - 1991 Winter')\n",
" plt.savefig('./'+IMAGES_FOLDER+'/tourists_vs_residents_winter.png')\n",
" plt.close()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Defining webpages"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def Web_pages():\n",
" html = open(HTML_FOLDER+'/'+INDEX_PAGE,'w')\n",
" markup = \"\"\"\n",
" head>\n",
"
ody>\n",
"

Here are the various aspects of passenger movements with respective graphs
p>\n",
"