ContinuumIO/blaze — pull request #295 by mrocklin (2014-05-26 17:45:35+00:00)
Title: Arbitrary functions

Provides the injection of arbitrary Python functions into a Blaze expression tree. Support for Python and Pandas backends only.

```Python
In [4]: data = [['A', 0], ['B', 1]]

In [5]: t = TableSymbol('{foo: string, datetime: int64}')

In [6]: list(compute(t['datetime'].map(datetime.utcfromtimestamp), data))
Out[6]: [datetime.datetime(1970, 1, 1, 0, 0), datetime.datetime(1970, 1, 1, 0, 0, 1)]

In [7]: compute(t['datetime'].map(datetime.utcfromtimestamp).apply(max), data)
Out[7]: datetime.datetime(1970, 1, 1, 0, 0, 1)
```

Some potential issues:

1. I use the term `apply` differently than Pandas. To me apply means "apply this function onto the whole table" while `map` means "apply this function rowwise onto the table. The pandas definition is pretty magical and means both in various cases.
2. I don't support SQL (though there isn't much we should do about this just yet.)
3. datashapes of the result aren't defined. They can be optionally defined.