{ "metadata": { "name": "", "signature": "sha256:92d34d2e31bb3e01df57dabeff388640224e685aca2834ee1a2ec1c28c039139" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "import json\n", "import requests" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "impostos = requests.get(\"http://localhost:5000/api/v1/receita/total?code=1.1.1&years=2014&drilldown=true\").content\n", "#taxas = requests.get(\"http://localhost:5000/api/v1/receita/total?code=1.1.2&years=2014&drilldown=true\").content" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "impostos_dict = json.loads(impostos)\n", "#taxas_dict = json.loads(taxas)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "impostos_dict" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 6, "text": [ "{u'data': [{u'code': u'111.2',\n", " u'name': u'Impostos sobre o Patrim\\xf4nio e a Renda',\n", " u'value': 8523435078.62},\n", " {u'code': u'111.3',\n", " u'name': u'Impostos sobre a Produ\\xe7\\xe3o e a Circula\\xe7\\xe3o',\n", " u'value': 11045723056.56}],\n", " u'name': u'Total Outcome'}" ] } ], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [ "def create_treemap(code, name=''):\n", " \n", " api_request_data = requests.get(\"http://localhost:5000/api/v1/receita/total?code={}&years=2014&drilldown=true\".format(code)).content\n", "\n", " treemap = {}\n", " treemap['name'] = name\n", " treemap['children'] = []\n", " request_dict = json.loads(api_request_data)\n", "\n", " for child in request_dict['data']:\n", " if code.count('.') < 3:\n", " treemap['children'] += [create_treemap(child['code'], child['name'])]\n", " else:\n", " if float(child['value']) != 0:\n", " treemap['children'] += [{'name': child['name'], 'value': child['value']}]\n", " \n", " return treemap" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 33 }, { "cell_type": "code", "collapsed": false, "input": [ "i = create_treemap('112', name='Taxas')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 38 }, { "cell_type": "code", "collapsed": false, "input": [ "i" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 39, "text": [ "{'children': [{'children': [{'children': [{'children': [{'name': u'TAXA DE ESTUDOS P/ FIXA\\xc7\\xc3O DE DIRETRIZES',\n", " 'value': 1052879.79}],\n", " 'name': u'TAXA DE CONSERVA\\xc7\\xc3O DE VIAS E LOGRADOUROS P\\xdaBLICOS'},\n", " {'children': [{'name': u'TAXA DE ESTUDOS P/ FIXA\\xc7\\xc3O DE DIRETRIZES',\n", " 'value': 1052879.79}],\n", " 'name': u'TAXA DE COMBATE A SINISTROS'},\n", " {'children': [{'name': u'TAXA DE ESTUDOS P/ FIXA\\xc7\\xc3O DE DIRETRIZES',\n", " 'value': 1052879.79}],\n", " 'name': u'TAXA DE ESTUDOS P/ FIXA\\xc7\\xc3O DE DIRETRIZES'}],\n", " 'name': u'Outras Taxas pela Presta\\xe7\\xe3o de Servi\\xe7os'},\n", " {'children': [{'children': [{'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DOMICILIARES - TRSD',\n", " 'value': 25594.45},\n", " {'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DE SERVI\\xc7OS DE SA\\xdaDE - TRSS',\n", " 'value': 47193031.85}],\n", " 'name': u'TAXA DE LIMPEZA P\\xdaBLICA'},\n", " {'children': [{'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DOMICILIARES - TRSD',\n", " 'value': 25594.45},\n", " {'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DE SERVI\\xc7OS DE SA\\xdaDE - TRSS',\n", " 'value': 47193031.85}],\n", " 'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DOMICILIARES - TRSD'},\n", " {'children': [{'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DOMICILIARES - TRSD',\n", " 'value': 25594.45},\n", " {'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DE SERVI\\xc7OS DE SA\\xdaDE - TRSS',\n", " 'value': 47193031.85}],\n", " 'name': u'TAXA DE RES\\xcdDUOS S\\xd3LIDOS DE SERVI\\xc7OS DE SA\\xdaDE - TRSS'}],\n", " 'name': u'Taxa de Limpeza P\\xfablica'}],\n", " 'name': u'Taxas pela Presta\\xe7\\xe3o de Servi\\xe7os'},\n", " {'children': [{'children': [{'children': [{'name': u'TAXA DE VISTORIA DE APARELHOS DE TRANSPORTE VERTICAL E HORIZONTAL',\n", " 'value': 8847031.77}],\n", " 'name': u'TAXA DE VISTORIA DE APARELHOS DE TRANSPORTE VERTICAL E HORIZONTAL'}],\n", " 'name': u'Taxa de Fiscaliza\\xe7\\xe3o de Aparelhos de Transporte'},\n", " {'children': [{'children': [{'name': u'TAXA DE LICEN\\xc7A P/ ARRUAMENTOS E LOTEAMENTOS',\n", " 'value': 236.38},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DOS SERVI\\xc7OS DE LIMPEZA URBANA - FISLURB',\n", " 'value': 1327735.29},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE CEMIT\\xc9RIOS',\n", " 'value': 1528236.82},\n", " {'name': u'TAXA DE REMO\\xc7\\xc3O - CET', 'value': 7934912.63}],\n", " 'name': u'TAXA DE LICEN\\xc7A P/ TR\\xc1FEGO DE VE\\xcdCULOS'},\n", " {'children': [{'name': u'TAXA DE LICEN\\xc7A P/ ARRUAMENTOS E LOTEAMENTOS',\n", " 'value': 236.38},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DOS SERVI\\xc7OS DE LIMPEZA URBANA - FISLURB',\n", " 'value': 1327735.29},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE CEMIT\\xc9RIOS',\n", " 'value': 1528236.82},\n", " {'name': u'TAXA DE REMO\\xc7\\xc3O - CET', 'value': 7934912.63}],\n", " 'name': u'TAXA DE LICEN\\xc7A P/ ARRUAMENTOS E LOTEAMENTOS'},\n", " {'children': [{'name': u'TAXA DE LICEN\\xc7A P/ ARRUAMENTOS E LOTEAMENTOS',\n", " 'value': 236.38},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DOS SERVI\\xc7OS DE LIMPEZA URBANA - FISLURB',\n", " 'value': 1327735.29},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE CEMIT\\xc9RIOS',\n", " 'value': 1528236.82},\n", " {'name': u'TAXA DE REMO\\xc7\\xc3O - CET', 'value': 7934912.63}],\n", " 'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DOS SERVI\\xc7OS DE LIMPEZA URBANA - FISLURB'},\n", " {'children': [{'name': u'TAXA DE LICEN\\xc7A P/ ARRUAMENTOS E LOTEAMENTOS',\n", " 'value': 236.38},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DOS SERVI\\xc7OS DE LIMPEZA URBANA - FISLURB',\n", " 'value': 1327735.29},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE CEMIT\\xc9RIOS',\n", " 'value': 1528236.82},\n", " {'name': u'TAXA DE REMO\\xc7\\xc3O - CET', 'value': 7934912.63}],\n", " 'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE CEMIT\\xc9RIOS'},\n", " {'children': [{'name': u'TAXA DE LICEN\\xc7A P/ ARRUAMENTOS E LOTEAMENTOS',\n", " 'value': 236.38},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DOS SERVI\\xc7OS DE LIMPEZA URBANA - FISLURB',\n", " 'value': 1327735.29},\n", " {'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE CEMIT\\xc9RIOS',\n", " 'value': 1528236.82},\n", " {'name': u'TAXA DE REMO\\xc7\\xc3O - CET', 'value': 7934912.63}],\n", " 'name': u'TAXA DE REMO\\xc7\\xc3O - CET'}],\n", " 'name': u'Outras Taxas pelo Exerc\\xedcio do Poder de Pol\\xedcia'},\n", " {'children': [{'children': [{'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE AN\\xdaNCIOS',\n", " 'value': 16850185.89}],\n", " 'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE AN\\xdaNCIOS'}],\n", " 'name': u'Taxa de Publicidade Comercial'},\n", " {'children': [{'children': [{'name': u'TAXA P/ EXAME E VERIFICA\\xc7\\xc3O DE PROJETOS E CONSTRU\\xc7\\xd5ES',\n", " 'value': 85610353.83}],\n", " 'name': u'TAXA P/ EXAME E VERIFICA\\xc7\\xc3O DE PROJETOS E CONSTRU\\xc7\\xd5ES'}],\n", " 'name': u'Taxa de Aprova\\xe7\\xe3o do Projeto de Contru\\xe7\\xe3o Civil'},\n", " {'children': [{'children': [{'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE ESTABELECIMENTOS - TFE',\n", " 'value': 117461118.26}],\n", " 'name': u'TAXA DE LICEN\\xc7A P/ LOCALIZA\\xc7\\xc3O, INSTALA\\xc7\\xc3O E FUNCIONAMENTO'},\n", " {'children': [{'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE ESTABELECIMENTOS - TFE',\n", " 'value': 117461118.26}],\n", " 'name': u'TAXA DE VISTORIA DE NORMAS DE SEGURAN\\xc7A'},\n", " {'children': [{'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE ESTABELECIMENTOS - TFE',\n", " 'value': 117461118.26}],\n", " 'name': u'TAXA DE FISCALIZA\\xc7\\xc3O DE ESTABELECIMENTOS - TFE'}],\n", " 'name': u'Taxa de Licen\\xe7a para Funcionamento de Estabelecimentos Comerciais, Ind\\xfastria e Prestadora de Servi\\xe7os'}],\n", " 'name': u'Taxas pelo Exerc\\xedcio do Poder de Pol\\xedcia'}],\n", " 'name': 'Taxas'}" ] } ], "prompt_number": 39 }, { "cell_type": "code", "collapsed": false, "input": [ "imp_node = {}\n", "imp_node['name'] = 'Impostos'\n", "imp_node['children'] = []\n", "\n", "fapi_request_data" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 62 }, { "cell_type": "code", "collapsed": false, "input": [ "treemap_taxas = {}\n", "treemap_taxas['name'] = 'Taxas'\n", "treemap_taxa['children'] = []" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "tax_node = {}\n", "tax_node['name'] = 'Taxas'\n", "tax_node['children'] = []\n", "\n", "for tax_data in taxas_dict['data']:\n", " value, name = tax_data.values()\n", " tax_node['children'].append({'name': name, 'value': value})" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 57 }, { "cell_type": "code", "collapsed": false, "input": [ "treemap['children'] += [imp_node, tax_node]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 58 }, { "cell_type": "code", "collapsed": false, "input": [ "out = json.dumps(i, encoding=\"utf-8\", indent=2)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 40 }, { "cell_type": "code", "collapsed": false, "input": [ "f = open('taxas.json', 'w+')\n", "f.write(out)\n", "f.close()" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 41 }, { "cell_type": "code", "collapsed": false, "input": [ "!cat receitas.json" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "{\r\n", " \"name\": \"Impostos\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"Impostos sobre o Patrim\\u00f4nio e a Renda\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"Imposto sobre a Renda e Proventos de Qualquer Natureza\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \r\n", " \"value\": 242223.02\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \r\n", " \"value\": 226225681.79\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \r\n", " \"value\": 984846685.99\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \r\n", " \"value\": 242223.02\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \r\n", " \"value\": 226225681.79\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \r\n", " \"value\": 984846685.99\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \r\n", " \"value\": 242223.02\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \r\n", " \"value\": 226225681.79\r\n", " }, \r\n", " {\r\n", " \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \r\n", " \"value\": 984846685.99\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"ITBI - Imposto sobre Transmiss\\u00e3o \\\"Inter Vivos\\\" de Bens Im\\u00f3veis e de Direitos Reais sobre Im\\u00f3veis\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ TRANS. INTER-VIVOS DE BENS IM\\u00d3VEIS E DIR. REAIS S/ IM\\u00d3VEIS\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ TRANS. INTER-VIVOS DE BENS IM\\u00d3VEIS E DIR. REAIS S/ IM\\u00d3VEIS\", \r\n", " \"value\": 1405961460.17\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"IPTU - Imposto sobre a Propriedade Predial e Territorial Urbana\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ A PROPRIEDADE TERRITORIAL URBANA\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ A PROPRIEDADE TERRITORIAL URBANA\", \r\n", " \"value\": 255386563.21\r\n", " }, \r\n", " {\r\n", " \"name\": \"IMPOSTO S/ A PROPRIEDADE PREDIAL\", \r\n", " \"value\": 5650772464.44\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"IMPOSTO S/ A PROPRIEDADE PREDIAL\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ A PROPRIEDADE TERRITORIAL URBANA\", \r\n", " \"value\": 255386563.21\r\n", " }, \r\n", " {\r\n", " \"name\": \"IMPOSTO S/ A PROPRIEDADE PREDIAL\", \r\n", " \"value\": 5650772464.44\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"Impostos sobre a Produ\\u00e7\\u00e3o e a Circula\\u00e7\\u00e3o\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ VENDA A VAREJO DE COMBUST\\u00cdVEIS L\\u00cdQUIDOS E GASOSOS - IVV\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"IMPOSTO S/ VENDA A VAREJO DE COMBUST\\u00cdVEIS L\\u00cdQUIDOS E GASOSOS - IVV\", \r\n", " \"children\": []\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - Imposto sobre Servi\\u00e7os de Qualquer Natureza\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"ISS - CMSP\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"Adicional ISS - Fundo Municipal de Combate \\u00e0 Pobreza\", \r\n", " \"value\": 327653.07\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - SIMPLES NACIONAL\", \r\n", " \"value\": 924157539.39\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - Imposto sobre Servi\\u00e7os de Qualquer Natureza\", \r\n", " \"value\": 10121237864.1\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"Adicional ISS - Fundo Municipal de Combate \\u00e0 Pobreza\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"Adicional ISS - Fundo Municipal de Combate \\u00e0 Pobreza\", \r\n", " \"value\": 327653.07\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - SIMPLES NACIONAL\", \r\n", " \"value\": 924157539.39\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - Imposto sobre Servi\\u00e7os de Qualquer Natureza\", \r\n", " \"value\": 10121237864.1\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - SIMPLES NACIONAL\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"Adicional ISS - Fundo Municipal de Combate \\u00e0 Pobreza\", \r\n", " \"value\": 327653.07\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - SIMPLES NACIONAL\", \r\n", " \"value\": 924157539.39\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - Imposto sobre Servi\\u00e7os de Qualquer Natureza\", \r\n", " \"value\": 10121237864.1\r\n", " }\r\n", " ]\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - Imposto sobre Servi\\u00e7os de Qualquer Natureza\", \r\n", " \"children\": [\r\n", " {\r\n", " \"name\": \"Adicional ISS - Fundo Municipal de Combate \\u00e0 Pobreza\", \r\n", " \"value\": 327653.07\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - SIMPLES NACIONAL\", \r\n", " \"value\": 924157539.39\r\n", " }, \r\n", " {\r\n", " \"name\": \"ISS - Imposto sobre Servi\\u00e7os de Qualquer Natureza\", \r\n", " \"value\": 10121237864.1\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", " }\r\n", " ]\r\n", "}" ] } ], "prompt_number": 37 }, { "cell_type": "code", "collapsed": false, "input": [ "json.dumps(i, encoding=\"utf-8\", indent=2)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 29, "text": [ "'{\\n \"name\": \"Impostos\", \\n \"children\": [\\n {\\n \"name\": \"Impostos sobre o Patrim\\\\u00f4nio e a Renda\", \\n \"children\": [\\n {\\n \"name\": \"Imposto sobre a Renda e Proventos de Qualquer Natureza\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \\n \"value\": 242223.02\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \\n \"value\": 226225681.79\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \\n \"value\": 984846685.99\\n }\\n ]\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \\n \"value\": 242223.02\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \\n \"value\": 226225681.79\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \\n \"value\": 984846685.99\\n }\\n ]\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO DE RENDA RETIDO NAS FONTES S/ REMESSA DE RECURSOS AO EXTERIOR\", \\n \"value\": 242223.02\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre Outros Rendimentos\", \\n \"value\": 226225681.79\\n }, \\n {\\n \"name\": \"IRRF - Imposto de Renda Retido nas Fontes sobre os Rendimentos do Trabalho\", \\n \"value\": 984846685.99\\n }\\n ]\\n }\\n ]\\n }, \\n {\\n \"name\": \"ITBI - Imposto sobre Transmiss\\\\u00e3o \\\\\"Inter Vivos\\\\\" de Bens Im\\\\u00f3veis e de Direitos Reais sobre Im\\\\u00f3veis\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ TRANS. INTER-VIVOS DE BENS IM\\\\u00d3VEIS E DIR. REAIS S/ IM\\\\u00d3VEIS\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ TRANS. INTER-VIVOS DE BENS IM\\\\u00d3VEIS E DIR. REAIS S/ IM\\\\u00d3VEIS\", \\n \"value\": 1405961460.17\\n }\\n ]\\n }\\n ]\\n }, \\n {\\n \"name\": \"IPTU - Imposto sobre a Propriedade Predial e Territorial Urbana\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ A PROPRIEDADE TERRITORIAL URBANA\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ A PROPRIEDADE TERRITORIAL URBANA\", \\n \"value\": 255386563.21\\n }, \\n {\\n \"name\": \"IMPOSTO S/ A PROPRIEDADE PREDIAL\", \\n \"value\": 5650772464.44\\n }\\n ]\\n }, \\n {\\n \"name\": \"IMPOSTO S/ A PROPRIEDADE PREDIAL\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ A PROPRIEDADE TERRITORIAL URBANA\", \\n \"value\": 255386563.21\\n }, \\n {\\n \"name\": \"IMPOSTO S/ A PROPRIEDADE PREDIAL\", \\n \"value\": 5650772464.44\\n }\\n ]\\n }\\n ]\\n }\\n ]\\n }, \\n {\\n \"name\": \"Impostos sobre a Produ\\\\u00e7\\\\u00e3o e a Circula\\\\u00e7\\\\u00e3o\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ VENDA A VAREJO DE COMBUST\\\\u00cdVEIS L\\\\u00cdQUIDOS E GASOSOS - IVV\", \\n \"children\": [\\n {\\n \"name\": \"IMPOSTO S/ VENDA A VAREJO DE COMBUST\\\\u00cdVEIS L\\\\u00cdQUIDOS E GASOSOS - IVV\", \\n \"children\": []\\n }\\n ]\\n }, \\n {\\n \"name\": \"ISS - Imposto sobre Servi\\\\u00e7os de Qualquer Natureza\", \\n \"children\": [\\n {\\n \"name\": \"ISS - CMSP\", \\n \"children\": [\\n {\\n \"name\": \"ISS - CMSP\", \\n \"value\": 0.0\\n }, \\n {\\n \"name\": \"Adicional ISS - Fundo Municipal de Combate \\\\u00e0 Pobreza\", \\n \"value\": 327653.07\\n }, \\n {\\n \"name\": \"ISS - SIMPLES NACIONAL\", \\n \"value\": 924157539.39\\n }, \\n {\\n \"name\": \"ISS - Imposto sobre Servi\\\\u00e7os de Qualquer Natureza\", \\n \"value\": 10121237864.1\\n }\\n ]\\n }, \\n {\\n \"name\": \"Adicional ISS - Fundo Municipal de Combate \\\\u00e0 Pobreza\", \\n \"children\": [\\n {\\n \"name\": \"ISS - CMSP\", \\n \"value\": 0.0\\n }, \\n {\\n \"name\": \"Adicional ISS - Fundo Municipal de Combate \\\\u00e0 Pobreza\", \\n \"value\": 327653.07\\n }, \\n {\\n \"name\": \"ISS - SIMPLES NACIONAL\", \\n \"value\": 924157539.39\\n }, \\n {\\n \"name\": \"ISS - Imposto sobre Servi\\\\u00e7os de Qualquer Natureza\", \\n \"value\": 10121237864.1\\n }\\n ]\\n }, \\n {\\n \"name\": \"ISS - SIMPLES NACIONAL\", \\n \"children\": [\\n {\\n \"name\": \"ISS - CMSP\", \\n \"value\": 0.0\\n }, \\n {\\n \"name\": \"Adicional ISS - Fundo Municipal de Combate \\\\u00e0 Pobreza\", \\n \"value\": 327653.07\\n }, \\n {\\n \"name\": \"ISS - SIMPLES NACIONAL\", \\n \"value\": 924157539.39\\n }, \\n {\\n \"name\": \"ISS - Imposto sobre Servi\\\\u00e7os de Qualquer Natureza\", \\n \"value\": 10121237864.1\\n }\\n ]\\n }, \\n {\\n \"name\": \"ISS - Imposto sobre Servi\\\\u00e7os de Qualquer Natureza\", \\n \"children\": [\\n {\\n \"name\": \"ISS - CMSP\", \\n \"value\": 0.0\\n }, \\n {\\n \"name\": \"Adicional ISS - Fundo Municipal de Combate \\\\u00e0 Pobreza\", \\n \"value\": 327653.07\\n }, \\n {\\n \"name\": \"ISS - SIMPLES NACIONAL\", \\n \"value\": 924157539.39\\n }, \\n {\\n \"name\": \"ISS - Imposto sobre Servi\\\\u00e7os de Qualquer Natureza\", \\n \"value\": 10121237864.1\\n }\\n ]\\n }\\n ]\\n }\\n ]\\n }\\n ]\\n}'" ] } ], "prompt_number": 29 }, { "cell_type": "code", "collapsed": false, "input": [ "s = '1121...'\n", "s.count('.')" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 7, "text": [ "3" ] } ], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }