This file contains hidden or 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 datetime | |
| def get_covid_data_jhu(dt_ini, dt_fim, us_columns = True, country = None): | |
| date_range = pd.date_range(start = dt_ini, end = dt_fim).to_list() | |
| string_range = [str(d.date().strftime("%m-%d-%Y")) for d in date_range] | |
| full_data_list = [] | |
| for dat in string_range: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 requests | |
| url = 'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?' | |
| situação = 'situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&esgotoInexistente=on' | |
| data = requests.get(url + situação).json() | |
| print ('Primeiras 100 escolas:') | |
| for escola in data[1]: | |
| print (f'{escola["nome"]}, {escola["cidade"]}, {escola["estado"]}') | |
| print ('Escolas em funcionamento, sem água, luz e esgoto:') | |
| print (data[0]) |
This file contains hidden or 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
| def boyermoore(p, t): | |
| m = len(p) | |
| n = len(t) | |
| if m > n: return -1 | |
| pulo = [m for k in range(256)] | |
| for k in range(m - 1): | |
| pulo[ord(p[k])] = m - k - 1 | |
| pulo = tuple(pulo) | |
| k = m - 1 | |
| while k < n: |
This file contains hidden or 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 ast | |
| import codegen | |
| expr=''' | |
| def resposta(): | |
| print ('Alô Mundo') | |
| ''' | |
| p = ast.parse(expr) | |
| p.body[0].body = [ast.parse('return 42').body[0]] |
This file contains hidden or 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 pymongo | |
| import requests | |
| headers = { | |
| 'Host': 'www.cnj.jus.br', | |
| 'Connection': 'keep-alive', | |
| 'Accept': 'application/json, text/plain, */*', | |
| 'Origin': 'http://www.cnj.jus.br', | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', | |
| 'Content-Type': 'application/json;charset=UTF-8', |
This file contains hidden or 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 pymongo | |
| import requests | |
| from redis import Redis | |
| from rq import Queue | |
| from bnmp_scraping_detail import download_court_order_detail | |
| headers = { | |
| 'Host': 'www.cnj.jus.br', | |
| 'Connection': 'keep-alive', | |
| 'Accept': 'application/json, text/plain, */*', |
This file contains hidden or 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 requests | |
| import json | |
| import time | |
| import threading | |
| from redis import Redis | |
| from rq import Queue | |
| from bnmp_scraping_court_orders import download_state_page | |
| headers = { | |
| 'Host': 'www.cnj.jus.br', |
This file contains hidden or 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 | |
| p = re.compile(r'\d+') | |
| d, m, a = p.findall('09-03-2018') | |
| print (d, m, a) | |
| d, m, a = p.findall('09/03/2018') | |
| print (d, m, a) | |
| a, m, d = p.findall('6(anos) 2(meses) 10(dias)') | |
| print(a, m, d) | |
| a, m, d = p.findall('6a2m10d') |
NewerOlder