Skip to content

Instantly share code, notes, and snippets.

View jtemporal's full-sized avatar
😎
Working from home

Jessica Temporal jtemporal

😎
Working from home
View GitHub Profile
import unicodedata
import pandas as pd
import grequests
from serenata_toolbox.datasets import fetch
fetch('2017-05-22-brazilian-cities.csv', 'data/')
@jtemporal
jtemporal / 2017-06-01-dataset-list.txt
Created June 1, 2017 10:35
A list of Serenata's datasets on S3
2016-07-26-AnoAnterior.zip
2016-07-26-AnoAtual.zip
2016-07-26-AnosAnteriores.zip
2016-08-08-AnoAnterior.csv
2016-08-08-AnoAnterior.zip
2016-08-08-AnoAtual.csv
2016-08-08-AnoAtual.zip
2016-08-08-AnosAnteriores.csv
2016-08-08-AnosAnteriores.zip
2016-08-08-ceap-datasets.md
@jtemporal
jtemporal / taxi-analysis.py
Created June 9, 2017 09:45
ipython history
import pandas as pd
import numpy as np
data = pd.read_csv('../serenata-data/2017-05-25-reimbursements.xz', dtype={'applicant_id': np.str,
'cnpj_cpf': np.str,
'congressperson_id': np.str,
'subquota_number': np.str},
low_memory=False)
data = data[data['subquota_description'] == 'Taxi, toll and parking']
data2014 = data[data['year'] == 2014]
$ python -m unittest discover tests
.................F................Could not find config.ini file.
You need Amazon section in it to interact with S3
(Check config.ini.example if you need a reference.)
.You need an Amazon section in config.ini to interact with S3 (Check config.ini.example if you need a reference.)
.Could not find config.ini file.
You need Amazon section in it to interact with S3
(Check config.ini.example if you need a reference.)
.Could not find config.ini file.
You need Amazon section in it to interact with S3
@jtemporal
jtemporal / sdist
Last active July 25, 2017 16:13
sdist output for serenata toolbox
$ python setup.py sdist
running sdist
running egg_info
writing serenata_toolbox.egg-info/PKG-INFO
writing dependency_links to serenata_toolbox.egg-info/dependency_links.txt
writing requirements to serenata_toolbox.egg-info/requires.txt
writing top-level names to serenata_toolbox.egg-info/top_level.txt
reading manifest file 'serenata_toolbox.egg-info/SOURCES.txt'
writing manifest file 'serenata_toolbox.egg-info/SOURCES.txt'
running check
@jtemporal
jtemporal / bdist_wheel
Created July 25, 2017 16:18
bdist_wheel output for serenata toolbox
$ python setup.py bdist_wheel --plat-name='any'
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/serenata_toolbox
creating build/lib/serenata_toolbox/federal_senate
copying serenata_toolbox/federal_senate/__init__.py -> build/lib/serenata_toolbox/federal_senate
copying serenata_toolbox/federal_senate/dataset.py -> build/lib/serenata_toolbox/federal_senate
$ twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading serenata_toolbox-12.0.4-py3-none-any.whl
Uploading serenata-toolbox-12.0.4.tar.gz
$ python manage.py test
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
.................FF....................................................................................................................................
======================================================================
FAIL: test_contents (jarbas.api.tests.test_reimbursement_view.TestRetrieveApi)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/temporal/src/dsbr/serenata/jarbas/jarbas/api/tests/test_reimbursement_view.py", line 119, in test_contents
self.assertEqual(self.sample_response, contents)
@jtemporal
jtemporal / gist:e071f71ab6e282bcce369d366aa4e935
Created August 8, 2017 17:11
error running Rosie toolbox v12.0.4
$ python rosie.py run chamber_of_deputies
/Users/temporal/src/dsbr/serenata/rosie/rosie/chamber_of_deputies/adapter.py:25: DtypeWarning: Columns (10) have mixed types. Specify dtype option on import or set low_memory=False.
self.update_datasets()
Merging all datasets…
Loading reimbursements-2009.xz…
Loading reimbursements-2010.xz…
Loading reimbursements-2011.xz…
Loading reimbursements-2012.xz…
Loading reimbursements-2013.xz…
Loading reimbursements-2014.xz…
@jtemporal
jtemporal / .travis.yml
Created August 14, 2017 18:18
Initial Toolbox travis configuration file
language: python
cache:
directories:
- $HOME/virtualenv/python3.5.3/
env:
- TEST_SUITE=unit
- TEST_SUITE=journey
python: 3.5
install:
- python setup.py develop