CREATE DATABASE fogocruzado
CREATE EXTENSION postgis;
# instalando pacotes necessários ---- | |
# install.packages("patchwork") | |
library(readr) | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(patchwork) | |
library(stringr) |
# instalando pyenv | |
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment | |
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \ | |
libbz2-dev libreadline-dev libsqlite3-dev curl \ | |
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev | |
# instalando | |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash | |
# instalando versao 3.11.1 | |
pyenv install 3.11.1 | |
# definindo versao global |
import pickle | |
from os import path | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from decouple import config | |
from google.auth.transport.requests import Request | |
from googleapiclient.discovery import build | |
CLIENT_SECRET = config("GOOGLE_CLIENT_SECRET") | |
GOOGLE_TOKEN = config("GOOGLE_TOKEN") | |
SCOPES = [ |
Problema solucionado. Veja no fim do documento a solução
Pessoall, bom dia!! Estive quebrando a cabeça com um ItemValidation... Será que voces podem ajudar?
Estou trabalhando com o scrapy
para raspagem de dados.
Estou raspando um item que é um horário, que está com o padrão "9h30", por exemplo.
Então no Items, criei uma função para converter a datetime.time, caso haja algum dado, caso contrário retorna None:
def convert_time(text):
from re import sub | |
from pytube import Playlist | |
# where to save | |
SAVE_PATH = "./" | |
# link of the playlist to be downloaded | |
p = Playlist("https://www.youtube.com/playlist?list=PLqa06jy1NEM3PI3eQGemUgEmKS5oHAw7B") | |
for video in p.videos: |
from scrapy.crawler import CrawlerProcess | |
from scrapy.utils.log import configure_logging | |
from scrapy.utils.project import get_project_settings | |
configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'}) | |
process = CrawlerProcess(get_project_settings()) | |
process.crawl('instituicoes') | |
process.crawl('agencias_reguladoras') | |
process.start() # the script will block here until the crawling is finished |
import os, glob | |
from zipfile import ZipFile | |
from osgeo import ogr | |
# Definindo path | |
diretorio = "/media/felipe/DATA/Repos/Potential for natural regeneration/RawData/MattFagan" | |
# Listing existing GPKGs | |
gpkgs = os.listdir(diretorio) | |
# loop trhu each gpkg |
library(raster) | |
# Como gerar um shp de um CSV ---- | |
ptos <- read.csv("./PDMA/Banco Dados Compartilhado/pts.geo.csv") | |
head(ptos) | |
# Transofrmando o DantaFrame em um dado espacial | |
coordinates(ptos) <- ~long+lat | |
class(ptos) | |
crs(ptos) | |
plot(ptos, axes=TRUE) |