Simple Forecasting Recently , I have been looking into various ways to forecast a time series dataset. This is an old pursuit in the field of statistics and there are many well known ways to achieve this. In this post I will demonstrate a very basic (Naive) approach of forecasting a quarterly dataset of sales figure, by using previous 4 years (16 quarters) and forecasting/predicting the next 1 year of sales aggregate.
Selenium is one of my favourite tool for automation. In this post, I will demonstrate some basic code to download a file from a website in a headless mode , and also provide a docker file to make things simpler. Python Code Here is some basic code which will make an attempt to download a **7zip exe. ** from pyvirtualdisplay import Display from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.
Scrapy is a very popular web scraping/crawling framework, I have been using it for quite some time now. In this post, I will demonstrate creating a very basic web crawler. Install Scrapy Installation is via pip pip install scrapy Minimalistic Code A very simple scraper is created like this To Run , simply type scrapy runspider scraper.py Running, above code will output something like below 2018-12-02 14:01:18 [scrapy.utils.log] INFO: Scrapy 1.
Here are few snippets to make secure http requests using various python libraries. httplib2 import httplib2 link = "https://example.com h = httplib2.Http(".cache") r, content = h.request(link, "GET") another exmaple import httplib2 h = httplib2.Http(".cache") h.add_credentials('user', 'pass') r, content = h.request("https://api.github.com", "GET") print r['status'] print r['content-type'] Urllib2 Here is a simmilar example using urlib2 for comparison and lines of code. import urllib2 gh_url = 'https://example.com' auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password(None, gh_url, 'user', 'password') opener = urllib2.