Skip to content

Instantly share code, notes, and snippets.

View cbini's full-sized avatar

Charlie Bini cbini

View GitHub Profile
@vdavez
vdavez / docx_mailmerge.py
Last active November 26, 2018 18:18
A way to mailmerge Word documents using Python
#!/usr/bin/env python
import zipfile
import string
from lxml import etree
def read_docx(filepath):
# todo: Add test to make sure it's a docx
zfile = zipfile.ZipFile(filepath)
# return the xml
@hunterowens
hunterowens / connect_and_load.py
Last active December 9, 2023 16:27
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)
@sloria
sloria / bobp-python.md
Last active July 24, 2024 02:53
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens