Skip to content

Instantly share code, notes, and snippets.

View mrmrn's full-sized avatar
🎯
Focusing

mrmrn

🎯
Focusing
View GitHub Profile
@00krishna
00krishna / pandas.postgres.py
Last active March 21, 2022 13:44
Connect from python pandas to a postgresql database and pull data.
import psycopg2 as pg
import pandas.io.sql as psql
# get connected to the database
connection = pg.connect("dbname=mydatabase user=postgres")
dataframe = psql.frame_query("SELECT * FROM <tablename>", connection)
@pmarshwx
pmarshwx / epanechnikov.pyx
Last active November 11, 2018 10:45
Epanechnikov kernel for use in Kernel Density Estimation. Note, for large arrays, performance may be slow. Originally designed for sparse grids.
cimport cython
import numpy as np
cimport numpy as np
cdef extern from 'math.h':
float exp(float x)
float cos(float x)
float sin(float x)
float fabs(float x)