A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
import select | |
import datetime | |
import psycopg2 | |
import psycopg2.extensions | |
from sqlalchemy import create_engine, text | |
engine = create_engine("postgresql+psycopg2://vagrant@/postgres") |
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) |
## THIS IS UNTESTED | |
from worker.models import TaskType | |
from website.celery import app | |
import importlib | |
# Dynamically add registered tasks | |
# Celery._tasks is a task registry object | |
# https://github.com/celery/celery/blob/34c43244b1681a59540936748800aaa504786a35/celery/app/base.py#L162 - _tasks |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
""" | |
_jaccard.py : Jaccard metric for comparing set similarity. | |
""" | |
import numpy as np | |
def jaccard(im1, im2): | |
""" |
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
bumpversion patch
$("#selectBox").append('<option value="option6">option6</option>'); |
DECLARE @ClarionDate INT = 47563 | |
DECLARE @SqlDateTime DATETIME | |
-- Convert the clarion DATE into and SQL DateTime | |
SET @SqlDateTime = DateAdd(day, @ClarionDate - 4, '1801-01-01') | |
SELECT @SqlDateTime AS 'SQL Date Time' | |
-- Now convert it back from and SQL DateTime to a Clarion Date | |
SET @ClarionDate = DateDiff(day, DateAdd(day, -4, '1801-01-01'), @SqlDateTime) |