{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# bopiip-jun17qtr-alltables" ] }, { "cell_type": "code", "execution_count": 2, "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" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "ddir = r'C:\\Users\\Glenn\\Documents\\Stats\\Oct 2017'\n", "ssheet ='bopiip-jun17qtr-alltables'" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": 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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Series_referencePeriodData_valueSuppressedSTATUSUNITSMAGNTUDESubjectGroupSeries_title_1
0BOPA.S06AC000000000A1972.031638.0NaNFDollars6Balance of Payments - BOPBPM6 Annual, Balance of payments major componentsActual
1BOPA.S06AC000000000A1973.032043.0NaNFDollars6Balance of Payments - BOPBPM6 Annual, Balance of payments major componentsActual
2BOPA.S06AC000000000A1974.032354.0NaNFDollars6Balance of Payments - BOPBPM6 Annual, Balance of payments major componentsActual
\n", "
" ], "text/plain": [ " Series_reference Period Data_value Suppressed STATUS UNITS \\\n", "0 BOPA.S06AC000000000A 1972.03 1638.0 NaN F Dollars \n", "1 BOPA.S06AC000000000A 1973.03 2043.0 NaN F Dollars \n", "2 BOPA.S06AC000000000A 1974.03 2354.0 NaN F Dollars \n", "\n", " MAGNTUDE Subject \\\n", "0 6 Balance of Payments - BOP \n", "1 6 Balance of Payments - BOP \n", "2 6 Balance of Payments - BOP \n", "\n", " Group Series_title_1 \n", "0 BPM6 Annual, Balance of payments major components Actual \n", "1 BPM6 Annual, Balance of payments major components Actual \n", "2 BPM6 Annual, Balance of payments major components Actual " ] }, "execution_count": 7, "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": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Subject
0Balance of Payments - BOP
98512International Investment Position - IIP
\n", "
" ], "text/plain": [ " Subject\n", "0 Balance of Payments - BOP\n", "98512 International Investment Position - IIP" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df1[['Subject']].drop_duplicates()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Group 52\n", "dtype: int64" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df1[['Group']].drop_duplicates().count()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Group 27\n", "dtype: int64" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df1[df1['Subject']=='International Investment Position - IIP'][['Group']].drop_duplicates().count()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": 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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Group
98512BPM6 Annual, International financial assets an...
98544BPM6 Annual, International non-equity financia...
98560BPM6 Annual, External lending and debt all sec...
98720BPM6 Annual, Int. non-equity financial instrum...
98928BPM6 Annual, International investment position...
99056BPM6 Annual, International investment position...
99248BPM6 Annual, External lending and debt by sect...
100139BPM6 Annual, International non-equity financia...
100347BPM6 Annual, International financial assets an...
100971BPM6 Annual, Directional basis stock of total ...
100987BPM6 Annual, Directional basis stock of direct...
101003BPM6 Annual, Stock of portfolio investment by ...
101019BPM6 Annual, Stock of other investment by country
101203BPM6 Annual, Directional basis stock of total ...
101219BPM6 Annual, Directional basis stock of direct...
101235BPM6 Annual, Directional basis international i...
118630BPM6 Annual, Hedging by currency
118646BPM6 Annual, Hedging by sector
135382BPM6 Quarterly, International financial assets...
135520BPM6 Quarterly, International non-equity finan...
135589BPM6 Quarterly, External lending and debt all ...
136210BPM6 Quarterly, Int. non-equity financial inst...
136831BPM6 Quarterly External lending and debt by se...
137120BPM6 Quarterly, International investment posit...
137465BPM6 Quarterly, International investment posit...
138293BPM6 Quarterly, External lending and debt by s...
141739BPM6 Quarterly, International non-equity finan...
\n", "
" ], "text/plain": [ " Group\n", "98512 BPM6 Annual, International financial assets an...\n", "98544 BPM6 Annual, International non-equity financia...\n", "98560 BPM6 Annual, External lending and debt all sec...\n", "98720 BPM6 Annual, Int. non-equity financial instrum...\n", "98928 BPM6 Annual, International investment position...\n", "99056 BPM6 Annual, International investment position...\n", "99248 BPM6 Annual, External lending and debt by sect...\n", "100139 BPM6 Annual, International non-equity financia...\n", "100347 BPM6 Annual, International financial assets an...\n", "100971 BPM6 Annual, Directional basis stock of total ...\n", "100987 BPM6 Annual, Directional basis stock of direct...\n", "101003 BPM6 Annual, Stock of portfolio investment by ...\n", "101019 BPM6 Annual, Stock of other investment by country\n", "101203 BPM6 Annual, Directional basis stock of total ...\n", "101219 BPM6 Annual, Directional basis stock of direct...\n", "101235 BPM6 Annual, Directional basis international i...\n", "118630 BPM6 Annual, Hedging by currency\n", "118646 BPM6 Annual, Hedging by sector\n", "135382 BPM6 Quarterly, International financial assets...\n", "135520 BPM6 Quarterly, International non-equity finan...\n", "135589 BPM6 Quarterly, External lending and debt all ...\n", "136210 BPM6 Quarterly, Int. non-equity financial inst...\n", "136831 BPM6 Quarterly External lending and debt by se...\n", "137120 BPM6 Quarterly, International investment posit...\n", "137465 BPM6 Quarterly, International investment posit...\n", "138293 BPM6 Quarterly, External lending and debt by s...\n", "141739 BPM6 Quarterly, International non-equity finan..." ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df1[df1['Subject']=='International Investment Position - IIP'][['Group']].drop_duplicates()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [conda root]", "language": "python", "name": "conda-root-py" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.12" } }, "nbformat": 4, "nbformat_minor": 1 }