{ "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of ClientsApplication CategoryApplication TypeApplication CriteriaApplication StreamApplication SubstreamBranch LocationApplicant TypeNationalityAge RangeGenderAgent Yes / NoDecision TypeMonth DecidedFinancial Year Decided
01PermitResident1995 Family child adultParent Sibling Adult Child StreamAdult ChildOffshorePrincipal Applicant / ApplicationIndia30-39 YearsMaleAgentDeclined2012-092012/13
11PermitResident1995 Family child adultParent Sibling Adult Child StreamAdult ChildOnshorePrincipal Applicant / ApplicationGreat Britain30-39 YearsFemaleNo AgentDeclined2008-092008/09
21PermitResident1995 Family child dependentUncapped Family Sponsored StreamDependant ChildOnshorePrincipal Applicant / ApplicationSolomon Islands20-29 YearsFemaleNo AgentApproved2008-012007/08
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Application Stream
Business / Skilled307691
International / Humanitarian40894
Parent Sibling Adult Child Stream59763
Uncapped Family Sponsored Stream117241
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Application Criteria
1995 Family child dependent5
1995 Family de facto1
1995 Family marriage75
2001 Family child dependent3250
Family Child dependent - Dependants of an Expatriate244
Family child dependent11465
October 2000 Transitional Policy - Defacto to NZ cit/res1
October 2000 Transitional Policy - Marriage to NZ cit/res1
Parent Retirement356
Partnership91214
Partnership - Partner of an Expatriate10243
Partnership deferral386
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Application Criteria
Month Decided
2007-09-011995 General skills
2008-07-01Employees of businesses
2008-02-01Entrepreneur (Transitional) Category
2011-02-01Entrepreneur Plus Category
2008-05-01Entrepreneur category
2008-09-01General Investor 2007
2009-11-01Global Investor 2007
2010-11-01Investor 1 Category
2011-02-01Investor 2 Category
2007-07-01Investor Category 2005
2008-04-01Investor category
2008-12-01Long Term Skill Shortage List Occupation
2011-04-01Skilled Migrant
2011-01-01Skills/Business deferral
2010-04-01Talent - Accredited Employer
2008-11-01Talent - Arts and Culture
2009-04-01Talent - Sports
2009-09-01Professional Investor 2007
2017-05-01Religious Worker
2017-08-01South Island Contribution
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Application Criteria
Professional Investor 20072
South Island Contribution3
Global Investor 200711
Investor category40
General Investor 200753
1995 General skills63
Talent - Arts and Culture64
Employees of businesses95
Investor Category 2005116
Entrepreneur (Transitional) Category145
Entrepreneur Plus Category239
Talent - Sports252
Skills/Business deferral368
Investor 1 Category789
Religious Worker1068
Long Term Skill Shortage List Occupation3593
Investor 2 Category6375
Entrepreneur category6562
Talent - Accredited Employer11018
Skilled Migrant276835
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of ClientsApplication CategoryApplication TypeApplication CriteriaApplication StreamApplication SubstreamBranch LocationApplicant TypeNationalityAge RangeGenderAgent Yes / NoDecision TypeMonth DecidedFinancial Year Decided
Month Decided
2012-09-011PermitResident1995 Family child adultParent Sibling Adult Child StreamAdult ChildOffshorePrincipal Applicant / ApplicationIndia30-39 YearsMaleAgentDeclined2012-092012/13
2008-09-011PermitResident1995 Family child adultParent Sibling Adult Child StreamAdult ChildOnshorePrincipal Applicant / ApplicationGreat Britain30-39 YearsFemaleNo AgentDeclined2008-092008/09
2008-01-011PermitResident1995 Family child dependentUncapped Family Sponsored StreamDependant ChildOnshorePrincipal Applicant / ApplicationSolomon Islands20-29 YearsFemaleNo AgentApproved2008-012007/08
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Application StreamMonth Decided
Business / Skilled2007-12-3112647
2008-12-3128397
2009-12-3126787
2010-12-3127218
2011-12-3121638
2012-12-3120229
2013-12-3120394
2014-12-3123846
2015-12-3128064
2016-12-3129226
2017-12-3118774
International / Humanitarian2007-12-311938
2008-12-313678
2009-12-313109
2010-12-312807
2011-12-312741
2012-12-313032
2013-12-313374
2014-12-313551
2015-12-313737
2016-12-314011
2017-12-313243
Parent Sibling Adult Child Stream2007-12-312507
2008-12-315622
2009-12-314451
2010-12-314450
2011-12-316056
2012-12-314497
2013-12-315306
2014-12-316301
2015-12-315024
2016-12-314732
2017-12-31347
Uncapped Family Sponsored Stream2007-12-314308
2008-12-319189
2009-12-319228
2010-12-319870
2011-12-3110361
2012-12-3111334
2013-12-3111578
2014-12-3111347
2015-12-3112180
2016-12-3111689
2017-12-319300
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Application Type
0Resident
61060Permanent Resident
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Application Criteria
01995 Family child adult
21995 Family child dependent
31995 Family de facto
41995 Family marriage
301995 Family parent
341995 Family sibling
371995 General skills
571995 Humanitarian
611995 Refugee Status
1941995 Refugee status
9012001 Family child adult
12102001 Family child dependent
23902001 Family parent
54722001 Family sibling
63592002 Refugee Family Sponsored
63662004 PAC Residence Kiribati
63692004 PAC Residence Tuvalu
63742005 PAC Residence Fiji
63912005 PAC Residence Kiribati
64012005 PAC Residence Tuvalu
64072005 Refugee Family Quota
64212005 Samoan Quota
64332006 PAC Fiji
64502006 PAC Kiribati
64692006 PAC Tonga
64732006 PAC Tuvalu
64752006 Refugee Family Quota
6483Employees of businesses
6498Entrepreneur (Transitional) Category
6612Entrepreneur Plus Category
......
111453PAC Tonga 2014
111601PAC Tonga 2015
111694PAC Tonga 2016
111838PAC Tonga 2017
111992PAC Tuvalu 2011
112023PAC Tuvalu 2012
112075PAC Tuvalu 2013
112114PAC Tuvalu 2014
112158PAC Tuvalu 2015
112224PAC Tuvalu 2016
149092Professional Investor 2007
149124Refugee Family
150872Refugee Family Support Tier 2
151649Refugee Medical
151745Refugee Ministerial Directive
151755Refugee Protection
153205Refugee Women at Risk
153565Refugee and Protection
154578Religious Worker
155467Samoan Quota
155468Samoan Quota 2004
156948Samoan Quota 2011
157170Samoan Quota 2012
157447Samoan Quota 2013
157726Samoan Quota 2014
157993Samoan Quota 2015
158271Samoan Quota 2016
158491Samoan Quota 2017
245392South Island Contribution
252306Victims of People Trafficking
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Application Criteria
Application Criteria
Skilled Migrant111473
Partnership44015
Family parent11778
Family Parent Tier 18586
Talent - Accredited Employer7057
2001 Family parent6696
Partnership - Partner of an Expatriate6599
Family child dependent5796
Family sibling5648
Entrepreneur category4802
Investor 2 Category3364
Ministerial direction3129
UNHCR Legal and Physical Protection Needs2678
Long Term Skill Shortage List Occupation2646
2001 Family sibling2571
2001 Family child dependent1968
Family child adult1591
Refugee Protection1395
Section 611220
Refugee Family Support Tier 11076
Refugee and Protection1013
Religious Worker889
Refugee Family Support Tier 2777
1995 Refugee status728
2001 Family child adult677
Investor 1 Category670
PAC Residual Places562
Victims of Domestic Violence540
Samoan Quota 2007498
Samoan Quota 2008484
......
2006 PAC Kiribati19
2005 Samoan Quota17
2005 PAC Residence Tonga14
2005 PAC Residence Tuvalu11
Global Investor 200710
2005 PAC Residence Kiribati10
Refugee Ministerial Directive10
Samoan Quota 201710
PAC Tonga 20179
2004 PAC Residence Fiji8
Family Parent Tier 28
2003 PAC Residence Kiribati7
2004 PAC Residence Kiribati7
2004 PAC Residence Tuvalu7
Samoan Quota 20046
1995 Family child dependent5
October 2000 Transitional Policy - 5 years in NZ4
1995 Family parent4
South Island Contribution3
1995 Family sibling3
October 2000 Transitional Policy - Parent of NZ Born Child2
Professional Investor 20072
1995 Family child adult2
Samoan Quota1
October 2000 Transitional Policy1
October 2000 Transitional Policy - Defacto to NZ cit/res1
October 2000 Transitional Policy - Marriage to NZ cit/res1
2002 PAC Residence Kiribati1
2002 Family quota adult sibling1
1995 Family de facto1
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Application Stream
Application Stream
Business / Skilled132209
International / Humanitarian23138
Parent Sibling Adult Child Stream37607
Uncapped Family Sponsored Stream59373
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Decision Type
Decision Type
Approved201024
Declined51303
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Financial Year Decided
2007/0846077
2008/0946097
2009/1045719
2010/1140737
2011/1240448
2012/1338961
2013/1444008
2014/1543085
2015/1652052
2016/1747684
2017/187250
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Month Decided
2007-12-3121400
2008-12-3146886
2009-12-3143575
2010-12-3144345
2011-12-3140796
2012-12-3139092
2013-12-3140652
2014-12-3145045
2015-12-3149005
2016-12-3149658
2017-12-3131664
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Number of Clients
Application TypeMonth Decided
Permanent Resident2014-12-3133
2015-12-31777
2016-12-311410
2017-12-31893
Resident2007-12-3121400
2008-12-3146886
2009-12-3143575
2010-12-3144345
2011-12-3140796
2012-12-3139092
2013-12-3140652
2014-12-3145012
2015-12-3148228
2016-12-3148248
2017-12-3130771
\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 }