Skip to content

Instantly share code, notes, and snippets.

View allatambov's full-sized avatar

Alla Tambovtseva allatambov

View GitHub Profile
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
df = pd.read_csv("https://allatambov.github.io/pydj/seminars/wgi-new.csv")
tab = df["fh_type"].value_counts()
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
df = pd.read_csv("https://allatambov.github.io/pydj/seminars/wgi-new.csv")
tab = df["fh_type"].value_counts()
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
# если не установлен selenium, его необходимо установить
# см. здесь: https://nbviewer.jupyter.org/github/PyBasics-19/py-basics-19/blob/master/lectures/lect-selenium-1.ipynb
# импортируем
from selenium import webdriver as wb
# ссылка на сайт с документами
link = "https://hudoc.echr.coe.int/eng#{%22documentcollectionid2%22:[%22GRANDCHAMBER%22,%22CHAMBER%22]}"
# подгружаем драйвер для Chrome
# создаем выборку
x <- c(2, 5, 7, 8, 1, 0, 8, 12, 6, 27)
x
# находим число элементов в ней
length(x)
# минимум, максимум, среднее, медиана
min(x)
max(x)
wgi <- read.csv("https://allatambov.github.io/rprog/data/wgi-new.csv")
library(tidyverse)
ggplot(data = wgi, aes(x = va, y = rl)) + geom_point(color = "navy") +
labs(x = 'Voice & Accountability',
y = 'Rule of Law') +
stat_ellipse(color = "red")
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
import requests
from bs4 import BeautifulSoup
url = "https://nplus1.ru/"
page = requests.get(url)
soup = BeautifulSoup(page.text, 'lxml')
urls = []
for link in soup.find_all('a'):
if '/news' in link.get('href'):
urls.append(link.get('href'))
def get_info(url0):
page0 = requests.get(url0)
soup0 = BeautifulSoup(page0.text)
author = soup0.find_all('meta', {'name' : 'author'})[0]['content']
title = soup0.find_all('meta', {'property' : 'og:title'})[0]['content']
description = soup0.find_all('meta',
{'property' : 'og:description'})[0]['content']
date = soup0.find_all('meta', {'itemprop':'datePublished'})[0]['content']
rubrics = []
for r in soup0.find_all('p', {'class' : 'table'})[0].find_all('a'):
install.packages("rgdal")
install.packages("RColorBrewer")
install.packages("classInt")
library(rgdal)
library(RColorBrewer)
library(classInt)
library(tidyverse)
setwd("/Users/allat/Desktop/gadm36_RUS_shp/")