Skip to content

Instantly share code, notes, and snippets.

@aandr
aandr / README.md
Last active August 29, 2015 14:01
Scraper за протоколите от ЦИК за Избори за ЕП 2014

Инструкции

  1. Инсталирате нужните пакети:

    pip install pyquery

или в някои версии на Ubuntu:

 sudo apt-get install python-pyquery
<iframe width="100%" height="520" frameborder="0" src="http://alekandreev.cartodb.com/viz/40eb2a54-dc5b-11e4-96f6-0e4fddd5de28/embed_map" allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>
<iframe src="https://www.google.com/maps/d/embed?mid=z4QiSwLUxGWI.kezVbbMc4oi0" width="100%" height="480"></iframe>
<iframe width="100%" height="520" frameborder="0" src="http://alekandreev.cartodb.com/viz/4db10ea8-dd27-11e4-8070-0e0c41326911/embed_map" allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>
Оценки:
<iframe width="469" height="370" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1D3nfxtuW4rTKxvB7du8QIKgmt4PSen9NrBX6NshpQqA/pubchart?oid=314377398&amp;format=interactive"></iframe>
БЕЛ:
<iframe width="470" height="371" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1D3nfxtuW4rTKxvB7du8QIKgmt4PSen9NrBX6NshpQqA/pubchart?oid=1422029838&amp;format=interactive"></iframe>
Математика:
Оценки общо:
<iframe width="469" height="370" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1qXy4CBukNUxkXh9FgUq8PSozxrqC1HqQakdnrKEMeU0/pubchart?oid=1014888076&amp;format=interactive"></iframe>
Оценки БЕЛ:
<iframe width="469" height="370" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1qXy4CBukNUxkXh9FgUq8PSozxrqC1HqQakdnrKEMeU0/pubchart?oid=1416494937&amp;format=interactive"></iframe>
@aandr
aandr / svg
Created October 28, 2015 11:36
<svg width="470" height="620" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0,10)"><g><path class="link" d="M10,38.3710407239819C235,38.3710407239819 235,246.22926093514332 460,246.22926093514332" style="stroke-width: 71.9457px; fill: none; stroke: rgb(92, 16, 140); stroke-opacity: 0.4;"></path><path class="link" d="M10,198.66515837104075C235,198.66515837104075 235,36.372549019607845 460,36.372549019607845" style="stroke-width: 59.9548px; fill: none; stroke: rgb(0, 125, 245); stroke-opacity: 0.4;"></path><path class="link" d="M10,126.31221719457014C235,126.31221719457014 235,421.71191553544503 460,421.71191553544503" style="stroke-width: 59.9548px; fill: none; stroke: rgb(255, 0, 0); stroke-opacity: 0.4;"></path><path class="link" d="M10,362.5565610859729C235,362.5565610859729 235,155.09049773755657 460,155.09049773755657" style="stroke-width: 56.7572px; fill: none; stroke: rgb(21, 42, 107); stroke-opacity: 0.4;"></path><path class="link" d="M10,287.8054298642534C235,287.8054298642534 235,329.374
blah blah blah
import pandas
import numpy as np
from collections import defaultdict
data = pandas.read_csv("/Users/alek/Downloads/agenti3.csv", skiprows=1)
blanks = [None, '', ' ', 'Неустановена приналежност', 'Неустановена принедлежност', 'Няма данни', 'Неустановане принадлежност', 'Неустановена пренадлежност', 'Нустановена принадлежност', 'Неустанована принадлежност', 'Неустановена принадлежност']
data['is_agent'] = data['Установена принадлежност'].map(lambda x: x not in blanks)
print("Number of checked persons", len(data))
data = data[data['is_agent'] == True]
print("Numebr of agents", len(data))
{
"basicInfo": {
"Name": "John Smith",
"Email": "[email protected]",
"Client status": "VIP",
},
"orders": {
"#007018": {
"Products": {
"Minetonka Moosehide Mocassins": {