Фишки Python
29 subscribers
2 photos
3 files
29 links
Всё что ты хотел узнать, но ленился спросить.

Декораторы, итераторы и контракты.
Download Telegram
Scrapy - парсер всего и вся в Web
Pandas - обработка и анализ данных
Matplotlib - визуализация данных на Python 2D/3D
Seaborn - визуализация данных поверх matplotlib, красивые графики
Crossfilter - js data-processing libraries, быстрая фильтрация строк/столбцов в датасете
D3.js - визуализация на js
autoenv - переопределяет cd и автоматом подтягивает текущий .env
Selenium + PhantomJS
Scrapy можно попробовать scrapyjs
import sqlite3
import requests
from lxml import html
from lxml import etree
from datetime import datetime


def log(*s):
print("{0} [LOG]:".format(datetime.now()), *s)


def main():
r = requests.get("https://www.av ito.ru/krasnodar/avtomobili/vaz_lada?view=list&radius=0&s_trg=3&f=188_893b&i=1")
if r.status_code != 200:
log("Status code check fail: {}".format(r.status_code))
tree = html.fromstring(r.text)
res = []
l = tree.xpath('//div[@itemtype="http://sch ema.org/Product"]')
for p in l:
id = p.attrib.get('id')
price = p.xpath('.//p[@itemprop="price"]')[0].attrib.get('content')
mileage = p.xpath('div[@class="mileage"]')[0].text
desc = p.xpath('meta[@itemprop="description"]')[0].attrib.get('content')
res.append((id, mileage, desc))


if name == "main":
main()
Jupyter Notebook

python -m pip install --upgrade pip
python -m pip install jupyter

pip install numpy pandas scikit-learn matplotlib seaborn

jupyter notebook
Python для сложных задач (ru) Дж. Вандер Плас
IPython, NumPy, Pandas, Matplotlib, Scikit-Learn
NumPy — для работы с однородными данными в виде массивов
Pandas — для работы с неоднородными и поименованными данными
SciPy — для общих научных вычислительных задач
Matplotlib — для визуализаций типографского качества
IPython — для интерактивного выполнения и совместного использования кода
Scikit-Learn — для машинного обучения и множества других инструментов
Jupyter - автодополнение по Tab (It will also complete filenames in the current directory)
? -> Introduction and overview of IPython's features (this screen).
object? -> Details about 'object'.
object?? -> More detailed, verbose information about 'object'.
%quickref -> Quick reference of all IPython specific syntax and magics.
help -> Access Python's own help system.
%magic for information on the magic subsystem