Skip to content

Instantly share code, notes, and snippets.

@reznov11
reznov11 / soup_prettify2.py
Created December 21, 2018 18:54 — forked from dmattera/soup_prettify2.py
A simple way set custom indentation levels when using BeautifulSoup's soup.prettify()
# Python == 3.6.2
# bs4 == 4.6.0
# The current version of BeautifulSoup's soup.prettify() function only allows for
# an indentation level = to 1 space. This is a simple, reliable way to allow for the use
# of any indentation level you wish.
import requests
@dmattera
dmattera / soup_prettify2.py
Last active November 24, 2023 04:21
A simple way set custom indentation levels when using BeautifulSoup's soup.prettify()
# Python == 3.6.2
# bs4 == 4.6.0
# The current version of BeautifulSoup's soup.prettify() function only allows for
# an indentation level = to 1 space. This is a simple, reliable way to allow for the use
# of any indentation level you wish.
import requests
@ivannp
ivannp / rallies.r
Last active November 28, 2017 20:14
POTUS Rallies since Election Day
require(quantmod)
require(ggplot2)
require(ggthemes)
# The starting index in the elections dates and president's arrays
# start.index = 7
start.index = 6
# sp = getSymbols("^GSPC", from="1900-01-01", auto.assign=F)
sp = as.xts(read.csv.zoo('dji.csv', format='%Y%m%d', header=F, sep=",")[,1:4])