If your database doesn’t support pivots, here is a quick technique to get pivot columns with sqlalchemy
import operator
from sqlalchemy.sql import case, func, select
def pivot_report(report, pivot_on=None, pivot_columns=None, pivot_func=func.sum,
non_pivot_columns=None, group_by=None):
“”" produce a pivot [...]
Categories: python
- Published:
- October 30, 2009 – 6:23 pm
- Author:
- By James Casbon
The reason most people end up using a dynamic language is to avoid the boilerplate associated with object creation. You know, typing “FileWriter fout = new FileWriter(”fred.txt”);” gets boring quickly. I think this is a good enough reason to move to another language on its own. This boilerplate is also sometimes called [...]
Categories: python
- Published:
- October 28, 2009 – 5:54 pm
- Author:
- By James Casbon
I recently started using cogent – the COmparative GENomics Toolkit and discovered that it is an excellent piece of kit. A google search for ‘python ensembl‘ doesn’t even show it at all, yet it definitely has the best bindings for ensembl avaiable in python – they’re based on sqlalchemy making it easy enough to [...]
Categories: bioinformatics, ensembl, python
- Published:
- October 27, 2009 – 4:57 pm
- Author:
- By James Casbon