{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import string\n",
"import os\n",
"import matplotlib.pyplot as plt\n",
"from datetime import datetime"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"ddir = r'C:\\Users\\Glenn\\Documents\\Stats\\Oct 2017'\n",
"ssheet ='R1 - Residence Decisions by FY (data)'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
" Application Category | \n",
" Application Type | \n",
" Application Criteria | \n",
" Application Stream | \n",
" Application Substream | \n",
" Branch Location | \n",
" Applicant Type | \n",
" Nationality | \n",
" Age Range | \n",
" Gender | \n",
" Agent Yes / No | \n",
" Decision Type | \n",
" Month Decided | \n",
" Financial Year Decided | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1 | \n",
" Permit | \n",
" Resident | \n",
" 1995 Family child adult | \n",
" Parent Sibling Adult Child Stream | \n",
" Adult Child | \n",
" Offshore | \n",
" Principal Applicant / Application | \n",
" India | \n",
" 30-39 Years | \n",
" Male | \n",
" Agent | \n",
" Declined | \n",
" 2012-09 | \n",
" 2012/13 | \n",
"
\n",
" \n",
" 1 | \n",
" 1 | \n",
" Permit | \n",
" Resident | \n",
" 1995 Family child adult | \n",
" Parent Sibling Adult Child Stream | \n",
" Adult Child | \n",
" Onshore | \n",
" Principal Applicant / Application | \n",
" Great Britain | \n",
" 30-39 Years | \n",
" Female | \n",
" No Agent | \n",
" Declined | \n",
" 2008-09 | \n",
" 2008/09 | \n",
"
\n",
" \n",
" 2 | \n",
" 1 | \n",
" Permit | \n",
" Resident | \n",
" 1995 Family child dependent | \n",
" Uncapped Family Sponsored Stream | \n",
" Dependant Child | \n",
" Onshore | \n",
" Principal Applicant / Application | \n",
" Solomon Islands | \n",
" 20-29 Years | \n",
" Female | \n",
" No Agent | \n",
" Approved | \n",
" 2008-01 | \n",
" 2007/08 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients Application Category Application Type \\\n",
"0 1 Permit Resident \n",
"1 1 Permit Resident \n",
"2 1 Permit Resident \n",
"\n",
" Application Criteria Application Stream \\\n",
"0 1995 Family child adult Parent Sibling Adult Child Stream \n",
"1 1995 Family child adult Parent Sibling Adult Child Stream \n",
"2 1995 Family child dependent Uncapped Family Sponsored Stream \n",
"\n",
" Application Substream Branch Location Applicant Type \\\n",
"0 Adult Child Offshore Principal Applicant / Application \n",
"1 Adult Child Onshore Principal Applicant / Application \n",
"2 Dependant Child Onshore Principal Applicant / Application \n",
"\n",
" Nationality Age Range Gender Agent Yes / No Decision Type \\\n",
"0 India 30-39 Years Male Agent Declined \n",
"1 Great Britain 30-39 Years Female No Agent Declined \n",
"2 Solomon Islands 20-29 Years Female No Agent Approved \n",
"\n",
" Month Decided Financial Year Decided \n",
"0 2012-09 2012/13 \n",
"1 2008-09 2008/09 \n",
"2 2008-01 2007/08 "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1 = pd.read_csv(os.path.join(ddir,ssheet+\".csv\"))\n",
"df1.head(3)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Application Stream | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Business / Skilled | \n",
" 307691 | \n",
"
\n",
" \n",
" International / Humanitarian | \n",
" 40894 | \n",
"
\n",
" \n",
" Parent Sibling Adult Child Stream | \n",
" 59763 | \n",
"
\n",
" \n",
" Uncapped Family Sponsored Stream | \n",
" 117241 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Application Stream \n",
"Business / Skilled 307691\n",
"International / Humanitarian 40894\n",
"Parent Sibling Adult Child Stream 59763\n",
"Uncapped Family Sponsored Stream 117241"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1.groupby('Application Stream').sum()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Application Criteria | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 1995 Family child dependent | \n",
" 5 | \n",
"
\n",
" \n",
" 1995 Family de facto | \n",
" 1 | \n",
"
\n",
" \n",
" 1995 Family marriage | \n",
" 75 | \n",
"
\n",
" \n",
" 2001 Family child dependent | \n",
" 3250 | \n",
"
\n",
" \n",
" Family Child dependent - Dependants of an Expatriate | \n",
" 244 | \n",
"
\n",
" \n",
" Family child dependent | \n",
" 11465 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy - Defacto to NZ cit/res | \n",
" 1 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy - Marriage to NZ cit/res | \n",
" 1 | \n",
"
\n",
" \n",
" Parent Retirement | \n",
" 356 | \n",
"
\n",
" \n",
" Partnership | \n",
" 91214 | \n",
"
\n",
" \n",
" Partnership - Partner of an Expatriate | \n",
" 10243 | \n",
"
\n",
" \n",
" Partnership deferral | \n",
" 386 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Application Criteria \n",
"1995 Family child dependent 5\n",
"1995 Family de facto 1\n",
"1995 Family marriage 75\n",
"2001 Family child dependent 3250\n",
"Family Child dependent - Dependants of an Expat... 244\n",
"Family child dependent 11465\n",
"October 2000 Transitional Policy - Defacto to N... 1\n",
"October 2000 Transitional Policy - Marriage to ... 1\n",
"Parent Retirement 356\n",
"Partnership 91214\n",
"Partnership - Partner of an Expatriate 10243\n",
"Partnership deferral 386"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[df1['Application Stream']=='Uncapped Family Sponsored Stream'].groupby('Application Criteria').sum()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Application Criteria | \n",
"
\n",
" \n",
" Month Decided | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 2007-09-01 | \n",
" 1995 General skills | \n",
"
\n",
" \n",
" 2008-07-01 | \n",
" Employees of businesses | \n",
"
\n",
" \n",
" 2008-02-01 | \n",
" Entrepreneur (Transitional) Category | \n",
"
\n",
" \n",
" 2011-02-01 | \n",
" Entrepreneur Plus Category | \n",
"
\n",
" \n",
" 2008-05-01 | \n",
" Entrepreneur category | \n",
"
\n",
" \n",
" 2008-09-01 | \n",
" General Investor 2007 | \n",
"
\n",
" \n",
" 2009-11-01 | \n",
" Global Investor 2007 | \n",
"
\n",
" \n",
" 2010-11-01 | \n",
" Investor 1 Category | \n",
"
\n",
" \n",
" 2011-02-01 | \n",
" Investor 2 Category | \n",
"
\n",
" \n",
" 2007-07-01 | \n",
" Investor Category 2005 | \n",
"
\n",
" \n",
" 2008-04-01 | \n",
" Investor category | \n",
"
\n",
" \n",
" 2008-12-01 | \n",
" Long Term Skill Shortage List Occupation | \n",
"
\n",
" \n",
" 2011-04-01 | \n",
" Skilled Migrant | \n",
"
\n",
" \n",
" 2011-01-01 | \n",
" Skills/Business deferral | \n",
"
\n",
" \n",
" 2010-04-01 | \n",
" Talent - Accredited Employer | \n",
"
\n",
" \n",
" 2008-11-01 | \n",
" Talent - Arts and Culture | \n",
"
\n",
" \n",
" 2009-04-01 | \n",
" Talent - Sports | \n",
"
\n",
" \n",
" 2009-09-01 | \n",
" Professional Investor 2007 | \n",
"
\n",
" \n",
" 2017-05-01 | \n",
" Religious Worker | \n",
"
\n",
" \n",
" 2017-08-01 | \n",
" South Island Contribution | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Application Criteria\n",
"Month Decided \n",
"2007-09-01 1995 General skills\n",
"2008-07-01 Employees of businesses\n",
"2008-02-01 Entrepreneur (Transitional) Category\n",
"2011-02-01 Entrepreneur Plus Category\n",
"2008-05-01 Entrepreneur category\n",
"2008-09-01 General Investor 2007\n",
"2009-11-01 Global Investor 2007\n",
"2010-11-01 Investor 1 Category\n",
"2011-02-01 Investor 2 Category\n",
"2007-07-01 Investor Category 2005\n",
"2008-04-01 Investor category\n",
"2008-12-01 Long Term Skill Shortage List Occupation\n",
"2011-04-01 Skilled Migrant\n",
"2011-01-01 Skills/Business deferral\n",
"2010-04-01 Talent - Accredited Employer\n",
"2008-11-01 Talent - Arts and Culture\n",
"2009-04-01 Talent - Sports\n",
"2009-09-01 Professional Investor 2007\n",
"2017-05-01 Religious Worker\n",
"2017-08-01 South Island Contribution"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[df1['Application Stream']=='Business / Skilled'][['Application Criteria']].drop_duplicates()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Application Criteria | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Professional Investor 2007 | \n",
" 2 | \n",
"
\n",
" \n",
" South Island Contribution | \n",
" 3 | \n",
"
\n",
" \n",
" Global Investor 2007 | \n",
" 11 | \n",
"
\n",
" \n",
" Investor category | \n",
" 40 | \n",
"
\n",
" \n",
" General Investor 2007 | \n",
" 53 | \n",
"
\n",
" \n",
" 1995 General skills | \n",
" 63 | \n",
"
\n",
" \n",
" Talent - Arts and Culture | \n",
" 64 | \n",
"
\n",
" \n",
" Employees of businesses | \n",
" 95 | \n",
"
\n",
" \n",
" Investor Category 2005 | \n",
" 116 | \n",
"
\n",
" \n",
" Entrepreneur (Transitional) Category | \n",
" 145 | \n",
"
\n",
" \n",
" Entrepreneur Plus Category | \n",
" 239 | \n",
"
\n",
" \n",
" Talent - Sports | \n",
" 252 | \n",
"
\n",
" \n",
" Skills/Business deferral | \n",
" 368 | \n",
"
\n",
" \n",
" Investor 1 Category | \n",
" 789 | \n",
"
\n",
" \n",
" Religious Worker | \n",
" 1068 | \n",
"
\n",
" \n",
" Long Term Skill Shortage List Occupation | \n",
" 3593 | \n",
"
\n",
" \n",
" Investor 2 Category | \n",
" 6375 | \n",
"
\n",
" \n",
" Entrepreneur category | \n",
" 6562 | \n",
"
\n",
" \n",
" Talent - Accredited Employer | \n",
" 11018 | \n",
"
\n",
" \n",
" Skilled Migrant | \n",
" 276835 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Application Criteria \n",
"Professional Investor 2007 2\n",
"South Island Contribution 3\n",
"Global Investor 2007 11\n",
"Investor category 40\n",
"General Investor 2007 53\n",
"1995 General skills 63\n",
"Talent - Arts and Culture 64\n",
"Employees of businesses 95\n",
"Investor Category 2005 116\n",
"Entrepreneur (Transitional) Category 145\n",
"Entrepreneur Plus Category 239\n",
"Talent - Sports 252\n",
"Skills/Business deferral 368\n",
"Investor 1 Category 789\n",
"Religious Worker 1068\n",
"Long Term Skill Shortage List Occupation 3593\n",
"Investor 2 Category 6375\n",
"Entrepreneur category 6562\n",
"Talent - Accredited Employer 11018\n",
"Skilled Migrant 276835"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[df1['Application Stream']=='Business / Skilled'].groupby('Application Criteria').sum().sort_values('Number of Clients')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"s1=df1.loc[:,'Month Decided'].apply(lambda x:pd.to_datetime(datetime(int(x[:4]),int(x[5:]),1 )))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df1.index = s1"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"df2 = df1.reindex()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
" Application Category | \n",
" Application Type | \n",
" Application Criteria | \n",
" Application Stream | \n",
" Application Substream | \n",
" Branch Location | \n",
" Applicant Type | \n",
" Nationality | \n",
" Age Range | \n",
" Gender | \n",
" Agent Yes / No | \n",
" Decision Type | \n",
" Month Decided | \n",
" Financial Year Decided | \n",
"
\n",
" \n",
" Month Decided | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 2012-09-01 | \n",
" 1 | \n",
" Permit | \n",
" Resident | \n",
" 1995 Family child adult | \n",
" Parent Sibling Adult Child Stream | \n",
" Adult Child | \n",
" Offshore | \n",
" Principal Applicant / Application | \n",
" India | \n",
" 30-39 Years | \n",
" Male | \n",
" Agent | \n",
" Declined | \n",
" 2012-09 | \n",
" 2012/13 | \n",
"
\n",
" \n",
" 2008-09-01 | \n",
" 1 | \n",
" Permit | \n",
" Resident | \n",
" 1995 Family child adult | \n",
" Parent Sibling Adult Child Stream | \n",
" Adult Child | \n",
" Onshore | \n",
" Principal Applicant / Application | \n",
" Great Britain | \n",
" 30-39 Years | \n",
" Female | \n",
" No Agent | \n",
" Declined | \n",
" 2008-09 | \n",
" 2008/09 | \n",
"
\n",
" \n",
" 2008-01-01 | \n",
" 1 | \n",
" Permit | \n",
" Resident | \n",
" 1995 Family child dependent | \n",
" Uncapped Family Sponsored Stream | \n",
" Dependant Child | \n",
" Onshore | \n",
" Principal Applicant / Application | \n",
" Solomon Islands | \n",
" 20-29 Years | \n",
" Female | \n",
" No Agent | \n",
" Approved | \n",
" 2008-01 | \n",
" 2007/08 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients Application Category Application Type \\\n",
"Month Decided \n",
"2012-09-01 1 Permit Resident \n",
"2008-09-01 1 Permit Resident \n",
"2008-01-01 1 Permit Resident \n",
"\n",
" Application Criteria Application Stream \\\n",
"Month Decided \n",
"2012-09-01 1995 Family child adult Parent Sibling Adult Child Stream \n",
"2008-09-01 1995 Family child adult Parent Sibling Adult Child Stream \n",
"2008-01-01 1995 Family child dependent Uncapped Family Sponsored Stream \n",
"\n",
" Application Substream Branch Location \\\n",
"Month Decided \n",
"2012-09-01 Adult Child Offshore \n",
"2008-09-01 Adult Child Onshore \n",
"2008-01-01 Dependant Child Onshore \n",
"\n",
" Applicant Type Nationality \\\n",
"Month Decided \n",
"2012-09-01 Principal Applicant / Application India \n",
"2008-09-01 Principal Applicant / Application Great Britain \n",
"2008-01-01 Principal Applicant / Application Solomon Islands \n",
"\n",
" Age Range Gender Agent Yes / No Decision Type Month Decided \\\n",
"Month Decided \n",
"2012-09-01 30-39 Years Male Agent Declined 2012-09 \n",
"2008-09-01 30-39 Years Female No Agent Declined 2008-09 \n",
"2008-01-01 20-29 Years Female No Agent Approved 2008-01 \n",
"\n",
" Financial Year Decided \n",
"Month Decided \n",
"2012-09-01 2012/13 \n",
"2008-09-01 2008/09 \n",
"2008-01-01 2007/08 "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.head(3)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Application Stream | \n",
" Month Decided | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Business / Skilled | \n",
" 2007-12-31 | \n",
" 12647 | \n",
"
\n",
" \n",
" 2008-12-31 | \n",
" 28397 | \n",
"
\n",
" \n",
" 2009-12-31 | \n",
" 26787 | \n",
"
\n",
" \n",
" 2010-12-31 | \n",
" 27218 | \n",
"
\n",
" \n",
" 2011-12-31 | \n",
" 21638 | \n",
"
\n",
" \n",
" 2012-12-31 | \n",
" 20229 | \n",
"
\n",
" \n",
" 2013-12-31 | \n",
" 20394 | \n",
"
\n",
" \n",
" 2014-12-31 | \n",
" 23846 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 28064 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 29226 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 18774 | \n",
"
\n",
" \n",
" International / Humanitarian | \n",
" 2007-12-31 | \n",
" 1938 | \n",
"
\n",
" \n",
" 2008-12-31 | \n",
" 3678 | \n",
"
\n",
" \n",
" 2009-12-31 | \n",
" 3109 | \n",
"
\n",
" \n",
" 2010-12-31 | \n",
" 2807 | \n",
"
\n",
" \n",
" 2011-12-31 | \n",
" 2741 | \n",
"
\n",
" \n",
" 2012-12-31 | \n",
" 3032 | \n",
"
\n",
" \n",
" 2013-12-31 | \n",
" 3374 | \n",
"
\n",
" \n",
" 2014-12-31 | \n",
" 3551 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 3737 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 4011 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 3243 | \n",
"
\n",
" \n",
" Parent Sibling Adult Child Stream | \n",
" 2007-12-31 | \n",
" 2507 | \n",
"
\n",
" \n",
" 2008-12-31 | \n",
" 5622 | \n",
"
\n",
" \n",
" 2009-12-31 | \n",
" 4451 | \n",
"
\n",
" \n",
" 2010-12-31 | \n",
" 4450 | \n",
"
\n",
" \n",
" 2011-12-31 | \n",
" 6056 | \n",
"
\n",
" \n",
" 2012-12-31 | \n",
" 4497 | \n",
"
\n",
" \n",
" 2013-12-31 | \n",
" 5306 | \n",
"
\n",
" \n",
" 2014-12-31 | \n",
" 6301 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 5024 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 4732 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 347 | \n",
"
\n",
" \n",
" Uncapped Family Sponsored Stream | \n",
" 2007-12-31 | \n",
" 4308 | \n",
"
\n",
" \n",
" 2008-12-31 | \n",
" 9189 | \n",
"
\n",
" \n",
" 2009-12-31 | \n",
" 9228 | \n",
"
\n",
" \n",
" 2010-12-31 | \n",
" 9870 | \n",
"
\n",
" \n",
" 2011-12-31 | \n",
" 10361 | \n",
"
\n",
" \n",
" 2012-12-31 | \n",
" 11334 | \n",
"
\n",
" \n",
" 2013-12-31 | \n",
" 11578 | \n",
"
\n",
" \n",
" 2014-12-31 | \n",
" 11347 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 12180 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 11689 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 9300 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Application Stream Month Decided \n",
"Business / Skilled 2007-12-31 12647\n",
" 2008-12-31 28397\n",
" 2009-12-31 26787\n",
" 2010-12-31 27218\n",
" 2011-12-31 21638\n",
" 2012-12-31 20229\n",
" 2013-12-31 20394\n",
" 2014-12-31 23846\n",
" 2015-12-31 28064\n",
" 2016-12-31 29226\n",
" 2017-12-31 18774\n",
"International / Humanitarian 2007-12-31 1938\n",
" 2008-12-31 3678\n",
" 2009-12-31 3109\n",
" 2010-12-31 2807\n",
" 2011-12-31 2741\n",
" 2012-12-31 3032\n",
" 2013-12-31 3374\n",
" 2014-12-31 3551\n",
" 2015-12-31 3737\n",
" 2016-12-31 4011\n",
" 2017-12-31 3243\n",
"Parent Sibling Adult Child Stream 2007-12-31 2507\n",
" 2008-12-31 5622\n",
" 2009-12-31 4451\n",
" 2010-12-31 4450\n",
" 2011-12-31 6056\n",
" 2012-12-31 4497\n",
" 2013-12-31 5306\n",
" 2014-12-31 6301\n",
" 2015-12-31 5024\n",
" 2016-12-31 4732\n",
" 2017-12-31 347\n",
"Uncapped Family Sponsored Stream 2007-12-31 4308\n",
" 2008-12-31 9189\n",
" 2009-12-31 9228\n",
" 2010-12-31 9870\n",
" 2011-12-31 10361\n",
" 2012-12-31 11334\n",
" 2013-12-31 11578\n",
" 2014-12-31 11347\n",
" 2015-12-31 12180\n",
" 2016-12-31 11689\n",
" 2017-12-31 9300"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df3 = df2[df2['Decision Type']=='Approved'].groupby(['Application Stream', pd.Grouper(freq='A')]).sum()\n",
"df3"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Application Type | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Resident | \n",
"
\n",
" \n",
" 61060 | \n",
" Permanent Resident | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Application Type\n",
"0 Resident\n",
"61060 Permanent Resident"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[['Application Type']].drop_duplicates()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Permanent Resident Visas. A Permanent Resident Visa is usually the next step after being granted a Resident Visa. While Resident Visas have travel conditions that only allow a person to re-enter New Zealand as a resident until a certain date, a Permanent Resident Visa allows indefinite re-entry to New Zealand."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Application Criteria | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1995 Family child adult | \n",
"
\n",
" \n",
" 2 | \n",
" 1995 Family child dependent | \n",
"
\n",
" \n",
" 3 | \n",
" 1995 Family de facto | \n",
"
\n",
" \n",
" 4 | \n",
" 1995 Family marriage | \n",
"
\n",
" \n",
" 30 | \n",
" 1995 Family parent | \n",
"
\n",
" \n",
" 34 | \n",
" 1995 Family sibling | \n",
"
\n",
" \n",
" 37 | \n",
" 1995 General skills | \n",
"
\n",
" \n",
" 57 | \n",
" 1995 Humanitarian | \n",
"
\n",
" \n",
" 61 | \n",
" 1995 Refugee Status | \n",
"
\n",
" \n",
" 194 | \n",
" 1995 Refugee status | \n",
"
\n",
" \n",
" 901 | \n",
" 2001 Family child adult | \n",
"
\n",
" \n",
" 1210 | \n",
" 2001 Family child dependent | \n",
"
\n",
" \n",
" 2390 | \n",
" 2001 Family parent | \n",
"
\n",
" \n",
" 5472 | \n",
" 2001 Family sibling | \n",
"
\n",
" \n",
" 6359 | \n",
" 2002 Refugee Family Sponsored | \n",
"
\n",
" \n",
" 6366 | \n",
" 2004 PAC Residence Kiribati | \n",
"
\n",
" \n",
" 6369 | \n",
" 2004 PAC Residence Tuvalu | \n",
"
\n",
" \n",
" 6374 | \n",
" 2005 PAC Residence Fiji | \n",
"
\n",
" \n",
" 6391 | \n",
" 2005 PAC Residence Kiribati | \n",
"
\n",
" \n",
" 6401 | \n",
" 2005 PAC Residence Tuvalu | \n",
"
\n",
" \n",
" 6407 | \n",
" 2005 Refugee Family Quota | \n",
"
\n",
" \n",
" 6421 | \n",
" 2005 Samoan Quota | \n",
"
\n",
" \n",
" 6433 | \n",
" 2006 PAC Fiji | \n",
"
\n",
" \n",
" 6450 | \n",
" 2006 PAC Kiribati | \n",
"
\n",
" \n",
" 6469 | \n",
" 2006 PAC Tonga | \n",
"
\n",
" \n",
" 6473 | \n",
" 2006 PAC Tuvalu | \n",
"
\n",
" \n",
" 6475 | \n",
" 2006 Refugee Family Quota | \n",
"
\n",
" \n",
" 6483 | \n",
" Employees of businesses | \n",
"
\n",
" \n",
" 6498 | \n",
" Entrepreneur (Transitional) Category | \n",
"
\n",
" \n",
" 6612 | \n",
" Entrepreneur Plus Category | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 111453 | \n",
" PAC Tonga 2014 | \n",
"
\n",
" \n",
" 111601 | \n",
" PAC Tonga 2015 | \n",
"
\n",
" \n",
" 111694 | \n",
" PAC Tonga 2016 | \n",
"
\n",
" \n",
" 111838 | \n",
" PAC Tonga 2017 | \n",
"
\n",
" \n",
" 111992 | \n",
" PAC Tuvalu 2011 | \n",
"
\n",
" \n",
" 112023 | \n",
" PAC Tuvalu 2012 | \n",
"
\n",
" \n",
" 112075 | \n",
" PAC Tuvalu 2013 | \n",
"
\n",
" \n",
" 112114 | \n",
" PAC Tuvalu 2014 | \n",
"
\n",
" \n",
" 112158 | \n",
" PAC Tuvalu 2015 | \n",
"
\n",
" \n",
" 112224 | \n",
" PAC Tuvalu 2016 | \n",
"
\n",
" \n",
" 149092 | \n",
" Professional Investor 2007 | \n",
"
\n",
" \n",
" 149124 | \n",
" Refugee Family | \n",
"
\n",
" \n",
" 150872 | \n",
" Refugee Family Support Tier 2 | \n",
"
\n",
" \n",
" 151649 | \n",
" Refugee Medical | \n",
"
\n",
" \n",
" 151745 | \n",
" Refugee Ministerial Directive | \n",
"
\n",
" \n",
" 151755 | \n",
" Refugee Protection | \n",
"
\n",
" \n",
" 153205 | \n",
" Refugee Women at Risk | \n",
"
\n",
" \n",
" 153565 | \n",
" Refugee and Protection | \n",
"
\n",
" \n",
" 154578 | \n",
" Religious Worker | \n",
"
\n",
" \n",
" 155467 | \n",
" Samoan Quota | \n",
"
\n",
" \n",
" 155468 | \n",
" Samoan Quota 2004 | \n",
"
\n",
" \n",
" 156948 | \n",
" Samoan Quota 2011 | \n",
"
\n",
" \n",
" 157170 | \n",
" Samoan Quota 2012 | \n",
"
\n",
" \n",
" 157447 | \n",
" Samoan Quota 2013 | \n",
"
\n",
" \n",
" 157726 | \n",
" Samoan Quota 2014 | \n",
"
\n",
" \n",
" 157993 | \n",
" Samoan Quota 2015 | \n",
"
\n",
" \n",
" 158271 | \n",
" Samoan Quota 2016 | \n",
"
\n",
" \n",
" 158491 | \n",
" Samoan Quota 2017 | \n",
"
\n",
" \n",
" 245392 | \n",
" South Island Contribution | \n",
"
\n",
" \n",
" 252306 | \n",
" Victims of People Trafficking | \n",
"
\n",
" \n",
"
\n",
"
141 rows × 1 columns
\n",
"
"
],
"text/plain": [
" Application Criteria\n",
"0 1995 Family child adult\n",
"2 1995 Family child dependent\n",
"3 1995 Family de facto\n",
"4 1995 Family marriage\n",
"30 1995 Family parent\n",
"34 1995 Family sibling\n",
"37 1995 General skills\n",
"57 1995 Humanitarian\n",
"61 1995 Refugee Status\n",
"194 1995 Refugee status\n",
"901 2001 Family child adult\n",
"1210 2001 Family child dependent\n",
"2390 2001 Family parent\n",
"5472 2001 Family sibling\n",
"6359 2002 Refugee Family Sponsored\n",
"6366 2004 PAC Residence Kiribati\n",
"6369 2004 PAC Residence Tuvalu\n",
"6374 2005 PAC Residence Fiji\n",
"6391 2005 PAC Residence Kiribati\n",
"6401 2005 PAC Residence Tuvalu\n",
"6407 2005 Refugee Family Quota\n",
"6421 2005 Samoan Quota\n",
"6433 2006 PAC Fiji\n",
"6450 2006 PAC Kiribati\n",
"6469 2006 PAC Tonga\n",
"6473 2006 PAC Tuvalu\n",
"6475 2006 Refugee Family Quota\n",
"6483 Employees of businesses\n",
"6498 Entrepreneur (Transitional) Category\n",
"6612 Entrepreneur Plus Category\n",
"... ...\n",
"111453 PAC Tonga 2014\n",
"111601 PAC Tonga 2015\n",
"111694 PAC Tonga 2016\n",
"111838 PAC Tonga 2017\n",
"111992 PAC Tuvalu 2011\n",
"112023 PAC Tuvalu 2012\n",
"112075 PAC Tuvalu 2013\n",
"112114 PAC Tuvalu 2014\n",
"112158 PAC Tuvalu 2015\n",
"112224 PAC Tuvalu 2016\n",
"149092 Professional Investor 2007\n",
"149124 Refugee Family\n",
"150872 Refugee Family Support Tier 2\n",
"151649 Refugee Medical\n",
"151745 Refugee Ministerial Directive\n",
"151755 Refugee Protection\n",
"153205 Refugee Women at Risk\n",
"153565 Refugee and Protection\n",
"154578 Religious Worker\n",
"155467 Samoan Quota\n",
"155468 Samoan Quota 2004\n",
"156948 Samoan Quota 2011\n",
"157170 Samoan Quota 2012\n",
"157447 Samoan Quota 2013\n",
"157726 Samoan Quota 2014\n",
"157993 Samoan Quota 2015\n",
"158271 Samoan Quota 2016\n",
"158491 Samoan Quota 2017\n",
"245392 South Island Contribution\n",
"252306 Victims of People Trafficking\n",
"\n",
"[141 rows x 1 columns]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[['Application Criteria']].drop_duplicates()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Application Criteria | \n",
"
\n",
" \n",
" Application Criteria | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Skilled Migrant | \n",
" 111473 | \n",
"
\n",
" \n",
" Partnership | \n",
" 44015 | \n",
"
\n",
" \n",
" Family parent | \n",
" 11778 | \n",
"
\n",
" \n",
" Family Parent Tier 1 | \n",
" 8586 | \n",
"
\n",
" \n",
" Talent - Accredited Employer | \n",
" 7057 | \n",
"
\n",
" \n",
" 2001 Family parent | \n",
" 6696 | \n",
"
\n",
" \n",
" Partnership - Partner of an Expatriate | \n",
" 6599 | \n",
"
\n",
" \n",
" Family child dependent | \n",
" 5796 | \n",
"
\n",
" \n",
" Family sibling | \n",
" 5648 | \n",
"
\n",
" \n",
" Entrepreneur category | \n",
" 4802 | \n",
"
\n",
" \n",
" Investor 2 Category | \n",
" 3364 | \n",
"
\n",
" \n",
" Ministerial direction | \n",
" 3129 | \n",
"
\n",
" \n",
" UNHCR Legal and Physical Protection Needs | \n",
" 2678 | \n",
"
\n",
" \n",
" Long Term Skill Shortage List Occupation | \n",
" 2646 | \n",
"
\n",
" \n",
" 2001 Family sibling | \n",
" 2571 | \n",
"
\n",
" \n",
" 2001 Family child dependent | \n",
" 1968 | \n",
"
\n",
" \n",
" Family child adult | \n",
" 1591 | \n",
"
\n",
" \n",
" Refugee Protection | \n",
" 1395 | \n",
"
\n",
" \n",
" Section 61 | \n",
" 1220 | \n",
"
\n",
" \n",
" Refugee Family Support Tier 1 | \n",
" 1076 | \n",
"
\n",
" \n",
" Refugee and Protection | \n",
" 1013 | \n",
"
\n",
" \n",
" Religious Worker | \n",
" 889 | \n",
"
\n",
" \n",
" Refugee Family Support Tier 2 | \n",
" 777 | \n",
"
\n",
" \n",
" 1995 Refugee status | \n",
" 728 | \n",
"
\n",
" \n",
" 2001 Family child adult | \n",
" 677 | \n",
"
\n",
" \n",
" Investor 1 Category | \n",
" 670 | \n",
"
\n",
" \n",
" PAC Residual Places | \n",
" 562 | \n",
"
\n",
" \n",
" Victims of Domestic Violence | \n",
" 540 | \n",
"
\n",
" \n",
" Samoan Quota 2007 | \n",
" 498 | \n",
"
\n",
" \n",
" Samoan Quota 2008 | \n",
" 484 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 2006 PAC Kiribati | \n",
" 19 | \n",
"
\n",
" \n",
" 2005 Samoan Quota | \n",
" 17 | \n",
"
\n",
" \n",
" 2005 PAC Residence Tonga | \n",
" 14 | \n",
"
\n",
" \n",
" 2005 PAC Residence Tuvalu | \n",
" 11 | \n",
"
\n",
" \n",
" Global Investor 2007 | \n",
" 10 | \n",
"
\n",
" \n",
" 2005 PAC Residence Kiribati | \n",
" 10 | \n",
"
\n",
" \n",
" Refugee Ministerial Directive | \n",
" 10 | \n",
"
\n",
" \n",
" Samoan Quota 2017 | \n",
" 10 | \n",
"
\n",
" \n",
" PAC Tonga 2017 | \n",
" 9 | \n",
"
\n",
" \n",
" 2004 PAC Residence Fiji | \n",
" 8 | \n",
"
\n",
" \n",
" Family Parent Tier 2 | \n",
" 8 | \n",
"
\n",
" \n",
" 2003 PAC Residence Kiribati | \n",
" 7 | \n",
"
\n",
" \n",
" 2004 PAC Residence Kiribati | \n",
" 7 | \n",
"
\n",
" \n",
" 2004 PAC Residence Tuvalu | \n",
" 7 | \n",
"
\n",
" \n",
" Samoan Quota 2004 | \n",
" 6 | \n",
"
\n",
" \n",
" 1995 Family child dependent | \n",
" 5 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy - 5 years in NZ | \n",
" 4 | \n",
"
\n",
" \n",
" 1995 Family parent | \n",
" 4 | \n",
"
\n",
" \n",
" South Island Contribution | \n",
" 3 | \n",
"
\n",
" \n",
" 1995 Family sibling | \n",
" 3 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy - Parent of NZ Born Child | \n",
" 2 | \n",
"
\n",
" \n",
" Professional Investor 2007 | \n",
" 2 | \n",
"
\n",
" \n",
" 1995 Family child adult | \n",
" 2 | \n",
"
\n",
" \n",
" Samoan Quota | \n",
" 1 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy | \n",
" 1 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy - Defacto to NZ cit/res | \n",
" 1 | \n",
"
\n",
" \n",
" October 2000 Transitional Policy - Marriage to NZ cit/res | \n",
" 1 | \n",
"
\n",
" \n",
" 2002 PAC Residence Kiribati | \n",
" 1 | \n",
"
\n",
" \n",
" 2002 Family quota adult sibling | \n",
" 1 | \n",
"
\n",
" \n",
" 1995 Family de facto | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
141 rows × 1 columns
\n",
"
"
],
"text/plain": [
" Application Criteria\n",
"Application Criteria \n",
"Skilled Migrant 111473\n",
"Partnership 44015\n",
"Family parent 11778\n",
"Family Parent Tier 1 8586\n",
"Talent - Accredited Employer 7057\n",
"2001 Family parent 6696\n",
"Partnership - Partner of an Expatriate 6599\n",
"Family child dependent 5796\n",
"Family sibling 5648\n",
"Entrepreneur category 4802\n",
"Investor 2 Category 3364\n",
"Ministerial direction 3129\n",
"UNHCR Legal and Physical Protection Needs 2678\n",
"Long Term Skill Shortage List Occupation 2646\n",
"2001 Family sibling 2571\n",
"2001 Family child dependent 1968\n",
"Family child adult 1591\n",
"Refugee Protection 1395\n",
"Section 61 1220\n",
"Refugee Family Support Tier 1 1076\n",
"Refugee and Protection 1013\n",
"Religious Worker 889\n",
"Refugee Family Support Tier 2 777\n",
"1995 Refugee status 728\n",
"2001 Family child adult 677\n",
"Investor 1 Category 670\n",
"PAC Residual Places 562\n",
"Victims of Domestic Violence 540\n",
"Samoan Quota 2007 498\n",
"Samoan Quota 2008 484\n",
"... ...\n",
"2006 PAC Kiribati 19\n",
"2005 Samoan Quota 17\n",
"2005 PAC Residence Tonga 14\n",
"2005 PAC Residence Tuvalu 11\n",
"Global Investor 2007 10\n",
"2005 PAC Residence Kiribati 10\n",
"Refugee Ministerial Directive 10\n",
"Samoan Quota 2017 10\n",
"PAC Tonga 2017 9\n",
"2004 PAC Residence Fiji 8\n",
"Family Parent Tier 2 8\n",
"2003 PAC Residence Kiribati 7\n",
"2004 PAC Residence Kiribati 7\n",
"2004 PAC Residence Tuvalu 7\n",
"Samoan Quota 2004 6\n",
"1995 Family child dependent 5\n",
"October 2000 Transitional Policy - 5 years in NZ 4\n",
"1995 Family parent 4\n",
"South Island Contribution 3\n",
"1995 Family sibling 3\n",
"October 2000 Transitional Policy - Parent of NZ... 2\n",
"Professional Investor 2007 2\n",
"1995 Family child adult 2\n",
"Samoan Quota 1\n",
"October 2000 Transitional Policy 1\n",
"October 2000 Transitional Policy - Defacto to N... 1\n",
"October 2000 Transitional Policy - Marriage to ... 1\n",
"2002 PAC Residence Kiribati 1\n",
"2002 Family quota adult sibling 1\n",
"1995 Family de facto 1\n",
"\n",
"[141 rows x 1 columns]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1.groupby('Application Criteria')[['Application Criteria']].count().sort_values('Application Criteria', ascending=False)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Number of Clients 1\n",
"Application Category Permit\n",
"Application Type Permanent Resident\n",
"Application Criteria 1995 Family child adult\n",
"Application Stream Business / Skilled\n",
"Application Substream 1995 Refugee status\n",
"Branch Location Offshore\n",
"Applicant Type Principal Applicant / Application\n",
"Nationality (not recorded)\n",
"Age Range 0-19 Years\n",
"Gender (not recorded)\n",
"Agent Yes / No Adviser (Exempt)\n",
"Decision Type Approved\n",
"Month Decided 2007-07\n",
"Financial Year Decided 2007/08\n",
"dtype: object"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1.min()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Application Stream | \n",
"
\n",
" \n",
" Application Stream | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Business / Skilled | \n",
" 132209 | \n",
"
\n",
" \n",
" International / Humanitarian | \n",
" 23138 | \n",
"
\n",
" \n",
" Parent Sibling Adult Child Stream | \n",
" 37607 | \n",
"
\n",
" \n",
" Uncapped Family Sponsored Stream | \n",
" 59373 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Application Stream\n",
"Application Stream \n",
"Business / Skilled 132209\n",
"International / Humanitarian 23138\n",
"Parent Sibling Adult Child Stream 37607\n",
"Uncapped Family Sponsored Stream 59373"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1.groupby('Application Stream')[['Application Stream']].count()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Decision Type | \n",
"
\n",
" \n",
" Decision Type | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Approved | \n",
" 201024 | \n",
"
\n",
" \n",
" Declined | \n",
" 51303 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Decision Type\n",
"Decision Type \n",
"Approved 201024\n",
"Declined 51303"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1.groupby('Decision Type')[['Decision Type']].count()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Financial Year Decided | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 2007/08 | \n",
" 46077 | \n",
"
\n",
" \n",
" 2008/09 | \n",
" 46097 | \n",
"
\n",
" \n",
" 2009/10 | \n",
" 45719 | \n",
"
\n",
" \n",
" 2010/11 | \n",
" 40737 | \n",
"
\n",
" \n",
" 2011/12 | \n",
" 40448 | \n",
"
\n",
" \n",
" 2012/13 | \n",
" 38961 | \n",
"
\n",
" \n",
" 2013/14 | \n",
" 44008 | \n",
"
\n",
" \n",
" 2014/15 | \n",
" 43085 | \n",
"
\n",
" \n",
" 2015/16 | \n",
" 52052 | \n",
"
\n",
" \n",
" 2016/17 | \n",
" 47684 | \n",
"
\n",
" \n",
" 2017/18 | \n",
" 7250 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Financial Year Decided \n",
"2007/08 46077\n",
"2008/09 46097\n",
"2009/10 45719\n",
"2010/11 40737\n",
"2011/12 40448\n",
"2012/13 38961\n",
"2013/14 44008\n",
"2014/15 43085\n",
"2015/16 52052\n",
"2016/17 47684\n",
"2017/18 7250"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[df1['Decision Type'] == 'Approved'].groupby(['Financial Year Decided'])[['Financial Year Decided','Number of Clients']].sum()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Month Decided | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 2007-12-31 | \n",
" 21400 | \n",
"
\n",
" \n",
" 2008-12-31 | \n",
" 46886 | \n",
"
\n",
" \n",
" 2009-12-31 | \n",
" 43575 | \n",
"
\n",
" \n",
" 2010-12-31 | \n",
" 44345 | \n",
"
\n",
" \n",
" 2011-12-31 | \n",
" 40796 | \n",
"
\n",
" \n",
" 2012-12-31 | \n",
" 39092 | \n",
"
\n",
" \n",
" 2013-12-31 | \n",
" 40652 | \n",
"
\n",
" \n",
" 2014-12-31 | \n",
" 45045 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 49005 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 49658 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 31664 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Month Decided \n",
"2007-12-31 21400\n",
"2008-12-31 46886\n",
"2009-12-31 43575\n",
"2010-12-31 44345\n",
"2011-12-31 40796\n",
"2012-12-31 39092\n",
"2013-12-31 40652\n",
"2014-12-31 45045\n",
"2015-12-31 49005\n",
"2016-12-31 49658\n",
"2017-12-31 31664"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[df1['Decision Type'] == 'Approved'].groupby([pd.Grouper(freq='A')])[['Financial Year Decided','Number of Clients']].sum()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" | \n",
" Number of Clients | \n",
"
\n",
" \n",
" Application Type | \n",
" Month Decided | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Permanent Resident | \n",
" 2014-12-31 | \n",
" 33 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 777 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 1410 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 893 | \n",
"
\n",
" \n",
" Resident | \n",
" 2007-12-31 | \n",
" 21400 | \n",
"
\n",
" \n",
" 2008-12-31 | \n",
" 46886 | \n",
"
\n",
" \n",
" 2009-12-31 | \n",
" 43575 | \n",
"
\n",
" \n",
" 2010-12-31 | \n",
" 44345 | \n",
"
\n",
" \n",
" 2011-12-31 | \n",
" 40796 | \n",
"
\n",
" \n",
" 2012-12-31 | \n",
" 39092 | \n",
"
\n",
" \n",
" 2013-12-31 | \n",
" 40652 | \n",
"
\n",
" \n",
" 2014-12-31 | \n",
" 45012 | \n",
"
\n",
" \n",
" 2015-12-31 | \n",
" 48228 | \n",
"
\n",
" \n",
" 2016-12-31 | \n",
" 48248 | \n",
"
\n",
" \n",
" 2017-12-31 | \n",
" 30771 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Number of Clients\n",
"Application Type Month Decided \n",
"Permanent Resident 2014-12-31 33\n",
" 2015-12-31 777\n",
" 2016-12-31 1410\n",
" 2017-12-31 893\n",
"Resident 2007-12-31 21400\n",
" 2008-12-31 46886\n",
" 2009-12-31 43575\n",
" 2010-12-31 44345\n",
" 2011-12-31 40796\n",
" 2012-12-31 39092\n",
" 2013-12-31 40652\n",
" 2014-12-31 45012\n",
" 2015-12-31 48228\n",
" 2016-12-31 48248\n",
" 2017-12-31 30771"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1[df1['Decision Type'] == 'Approved'].groupby(['Application Type',pd.Grouper(freq='A')])[['Financial Year Decided','Number of Clients']].sum()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"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.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 1
}