Koalas
Koalas is a singleton server for Pandas DataFrames.
Endpoints
-
POST /dataframe: load a new dataframe into the server. Most common is CSV, but JSON and HTML tables are also accepted. Set the "Content-Type" header to control parsing, and add additional args on the querystring (which will be passed to Pandas)Example:
curl -X POST http://localhost:5000/dataframe -H "Content-Type: text/csv" --data-binary @filename.csv -
POST /query: query an already loaded dataframe, using a pipeline of transformations. The format of the query looks something like this:curl -X POST http://localhost:5000/query \ -H "Accept: text/csv" \ -H "Content-Type: application/json" \ -d '[{"name": "select", "fields": ["one", "two", "three"]}]',
Transformations
The transformation pipeline is a JSON array of JSON objects, which requires a
name attribute (which is matched to one of the operation names below) and
accepts other named arguments as documented:
select: takesfieldsargument, returns new frame with only those fields selectedslice: takeslower,upper, andstepwhich are analagous to Python's slicelt,lte,gt,gte,eq,ne: take afieldandvalueargument to filter datagroupby: same as Pandas'groupbyoperation, it requiresfields(which can be a string or list) and optionally accepts the same named argumentsDataFrame.groupbydoes.sum,mean, andmedium: perform operation on a grouped setresample: resample the dataframe.ruleandhoware required (and take the same format as in Pandas) and all other named options toDataFrame.resampleare accepted.localize: localize aDateTimeIndexobject into a new timezone - this will calltz_convertortz_localizeas appropriate. In the case where you want to convert from one timezone to another, first localize into the source timezone then the destination.plot: takes the same named arguments asDataFrame.plot. TheAcceptheader must beimage/pngif this is used, and it should be the last operation in the pipeline.
Docker Image
A trusted build of Kaoals is available at brianhicks/koalas
But... Koalas?
Yeah, sure. I know Koalas aren't technically bears but they're pretty cool Marsupials and there's nothing quite like them. Plus they do this.
