Skip to content

Instantly share code, notes, and snippets.

@kolommik
kolommik / forecasting_metrics.py
Created February 21, 2020 07:58 — forked from Kalki5/forecasting_metrics.py
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
@kolommik
kolommik / connect_and_load.py
Created August 2, 2018 20:07 — forked from hunterowens/connect_and_load.py
Pandas and MSSQL
import pymssql
import pandas as pd
## instance a python db connection object- same form as psycopg2/python-mysql drivers also
conn = pymssql.connect(server="172.0.0.1", user="howens",password="some_fake_password", port=63642) # You can lookup the port number inside SQL server.
## Hey Look, college data
stmt = "SELECT * FROM AlumniMirror..someTable"
# Excute Query here
df = pd.read_sql(stmt,conn)