This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.display import HTML, Javascript, display | |
display( HTML(""" | |
<button class="toogle-button", id="botao">Mostrar/ocultar célula</button> | |
""")) | |
js = """ | |
var cell = $(".selected"); | |
var input_area = $(".input_area", cell); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BeautifulSoup as bs | |
from collections import defaultdict | |
xml_votos = open('./votos-camara.xml') | |
xml_data = bs.BeautifulSoup(xml_votos.read()) | |
dpts = xml_data.findAll('deputado') | |
hist_pt = defaultdict(int) | |
for d in dpts: | |
if d['voto'] != u'Não': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen | |
from json import dumps | |
import codecs | |
issue_info = {} | |
issue_info['milestone'] = 1 | |
cmd = ["curl", | |
"-i", | |
"-X", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import itertools as it | |
import operator as o | |
df = pd.DataFrame(np.random.randint(1,10,size=(100,6)), columns=['a1', 'a2', 'b1', 'b2', 'c1', 'c2']) | |
q = map(lambda x: '&'.join(x), it.product(*[['{}({} == 2)'.format(op, i) for op in ['~', '']] for i in ['a1', 'a2']])) | |
for qi in q: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import itertools as it | |
import operator as o | |
df = pd.DataFrame(np.random.randint(1,10,size=(100,6)), columns=['a1', 'a2', 'b1', 'b2', 'c1', 'c2']) | |
cs = map(lambda x: reduce(o.and_, x), | |
list(it.product(*[[op(df[i] == 2) for op in [lambda x: ~x, lambda x: x]] for i in ['a1', 'a2', 'c1']]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def is_prime(n): | |
ns = ''.join(['1' for _ in range(n)]) | |
return not re.match(r'^1?$|^(11+?)\1+$', ns) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Data.Text.Lazy as T | |
import qualified Data.Text.Lazy.IO as TI | |
import System.IO | |
main = do | |
file <- TI.readFile "input.map" | |
output <- openFile "output.map" WriteMode | |
let fileColumns = map (T.split (== '\t')) $ T.lines file |
NewerOlder