Package: blaze
Blazetranslates a subset of modified NumPy and Pandas-like syntax
to databases and other computing systems. Blaze allows Python users a
familiar interface to query data living in other data storage systems.ExampleWe point blaze to a simple dataset in a foreign database (PostgreSQL).
Instantly we see results as we would see them in a Pandas DataFrame.>>>importblazeasbz>>>iris=bz.Data('postgresql://localhost::iris')>>>irissepal_lengthsepal_widthpetal_lengthpetal_widthspecies05.13.51.40.2Iris-setosa14.93.01.40.2Iris-setosa24.73.21.30.2Iris-setosa34.63.11.50.2Iris-setosaThese results occur immediately. Blaze does not pull data out of
Postgres, instead it translates your Python commands into SQL (or
others.)>>>iris.species.distinct()species0Iris-setosa1Iris-versicolor2Iris-virginica>>>bz.by(iris.species,smallest=iris.petal_length.min(),...largest=iris.petal_length.max())specieslargestsmallest0Iris-setosa1.91.01Iris-versicolor5.13.02Iris-virginica6.94.5This same example would have worked with a wide range of databases,
on-disk text or binary files, or remote data.What Blaze is notBlaze does not perform computation. It relies on other systems like SQL,
Spark, or Pandas to do the actual number crunching. It is not a
replacement for any of these systems.Blaze does not implement the entire NumPy/Pandas API, nor does it
interact with libraries intended to work with NumPy/Pandas. This is the
cost of using more and larger data systems.Blaze is a good way to inspect data living in a large database, perform
a small but powerful set of operations to query that data, and then
transform your results into a format suitable for your favorite Python
tools.In the AbstractBlaze separates the computations that we want to perform:>>>accounts=Symbol('accounts','var * {id: int, name: string, amount: int}')>>>deadbeats=accounts[accounts.amount<0].nameFrom the representation of data>>>L=[[1,'Alice',100],...[2,'Bob',-200],...[3,'Charlie',300],...[4,'Denis',400],...[5,'Edith',-500]]Blaze enables users to solve data-oriented problems>>>list(compute(deadbeats,L))['Bob','Edith']But the separation of expression from data allows us to switch between
different backends.Here we solve the same problem using Pandas instead of Pure Python.>>>df=DataFrame(L,columns=['id','name','amount'])>>>compute(deadbeats,df)1Bob4EdithName:name,dtype:objectBlaze doesn’t compute these results, Blaze intelligently drives other
projects to compute them instead. These projects range from simple Pure
Python iterators to powerful distributed Spark clusters. Blaze is built
to be extended to new systems as they evolve.Getting StartedBlaze is available on conda or on PyPIconda install blaze
pip install blazeDevelopment builds are accessibleconda install blaze -c blaze
pip install http://github.com/blaze/blaze --upgradeYou may want to viewthe docs,the
tutorial,some
blogposts, or themailing list
archives.Development setupThe quickest way to install all Blaze dependencies withcondais as
followsconda install blaze spark -c blaze -c anaconda-cluster -y
conda remove odo blaze blaze-core datashape -yAfter running these commands, cloneodo,blaze, anddatashapefrom
GitHub directly.  These three projects release together.  Runpython setup.py developto make development installations of each.LicenseReleased under BSD license. SeeLICENSE.txtfor
details.Blaze development is sponsored by Continuum Analytics.