Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Flávio Codeço Coelho fccoelho

🏠
Working from home
View GitHub Profile
View pandas
#!/usr/bin/env python
# coding: utf-8
# # Exercícios
# In[11]:
import pandas as pd
get_ipython().run_line_magic('pylab', 'inline')
View openapi.json
{"openapi": "3.0.0", "servers": [{"url": "http://localhost:8080"}], "info": {"title": "Hathor API", "version": "0.16.0-beta"}, "consumes": ["application/json"], "produces": ["application/json"], "paths": {"/p2p/peers": {"x-visibility": "private", "post": {"tags": ["p2p"], "operationId": "p2p_peers", "summary": "Add p2p peers", "description": "Connect to the given peers", "requestBody": {"description": "Peers you want to connect to", "required": true, "content": {"application/json": {"schema": {"type": "array", "description": "List of peers to connect in the format \"protocol:host:port\"", "items": {"type": "string"}}, "examples": {"peer_list": {"summary": "List of peers", "value": ["tcp:localhost:8000", "tcp:17.24.137.234:40403"]}}}}}, "responses": {"200": {"description": "The peers we connected to (we don't try connecting to already known peers)", "content": {"application/json": {"examples": {"success": {"summary": "Peers added", "value": {"success": true, "peers": ["tcp:localhost:8000", "tcp:17.24.137.234:4
@fccoelho
fccoelho / app.py
Last active Sep 9, 2019
Dash app with maps and plotly express
View app.py
from flask import Flask
import plotly_express as px
import pandas as pd
import geopandas as gp
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
@fccoelho
fccoelho / fwf.csv
Created Jun 13, 2016
Pandas FWF bug
View fwf.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
12 13 5 0 11AVENIDA GOVERNADOR EDMUNDO PINTO 72 ACRELANDIA 01 00100169945000
12 13 5 0 11AVENIDA GOVERNADOR EDMUNDO PINTO 72 ACRELANDIA
View Spark logistic regression.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fccoelho
fccoelho / PyDSTool_benchmark.ipynb
Last active Aug 29, 2015
Benchmark of ODE solvers
View PyDSTool_benchmark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fccoelho
fccoelho / benchMongoDict.py
Created May 26, 2015
MongoDict benchmark
View benchMongoDict.py
"""
In [16]: %timeit dic_normal(1000)
1000 loops, best of 3: 802 µs per loop
In [17]: %timeit dic_mongo(1000)
1 loops, best of 3: 308 ms per loop
In [18]: dic2 = dic_normal(1000)
In [19]: %time col.insert(dic2)
CPU times: user 15.1 ms, sys: 600 µs, total: 15.7 ms
Wall time: 22.1 ms
"""
@fccoelho
fccoelho / Classifica_Artigos.ipynb
Created Jul 17, 2014
experimentos de classificação de artigos do MediaCLoud
View Classifica_Artigos.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fccoelho
fccoelho / cgillespie.pyx
Created Feb 14, 2013
Cython based Gillespie algorithm
View cgillespie.pyx
from numpy.random import uniform, multinomial, exponential
#from numpy import arange, array, empty,zeros
import numpy as np
cimport numpy as np
import time
from random import random
DTYPE = np.double
ctypedef np.double_t DTYPE_t
ctypedef np.int_t INT_t
@fccoelho
fccoelho / choropleth.js
Created Nov 27, 2012
D3.js map choroplethmap
View choropleth.js
<script src="/js/d3.v2.js"></script>
<link type="text/css" rel="stylesheet" href="/css/colorbrewer/colorbrewer.css">
<style type="text/css">
svg {
background: #eee;
width: 960px;
height: 500px;
}
#polygons path {
stroke: #fff;