agate 1.2.2

Build status PyPI downloads Version License Support Python versions

agate is a Python data analysis library that is optimized for humans instead of machines. It is an alternative to numpy and pandas that helps you solve real-world problems with readable code.

agate was previously known as journalism.

Important links:

Why agate?

  • A readable and user-friendly API.
  • A robust set of SQL-like operations.
  • Unicode support everywhere.
  • Decimal precision everywhere.
  • Exhaustive user documentation.
  • Pluggable extensions to add SQL integration, statistical methods, etc.
  • Designed with iPython, Jupyter and atom/hydrogen in mind.
  • Pure Python. No huge C dependencies to compile.
  • 100% test coverage.
  • MIT licensed. Free for all purposes.
  • Zealously zen.

Show me code

import agate

purchases = agate.Table.from_csv('examples/realdata/ks_1033_data.csv')

by_county = purchases.group_by('county')

totals = by_county.aggregate([
    ('county_cost', agate.Sum('total_cost'))
])

totals = totals.order_by('county_cost', reverse=True)
totals.limit(10).print_bars('county', 'county_cost', width=80)
county     county_cost
SEDGWICK    977,174.45 ▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
COFFEY      691,749.03 ▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MONTGOMERY  447,581.20 ▓░░░░░░░░░░░░░░░░░░░░░░░░░
JOHNSON     420,628.00 ▓░░░░░░░░░░░░░░░░░░░░░░░░
SALINE      245,450.24 ▓░░░░░░░░░░░░░░
FINNEY      171,862.20 ▓░░░░░░░░░░
BROWN       145,254.96 ▓░░░░░░░░
KIOWA        97,974.00 ▓░░░░░
WILSON       74,747.10 ▓░░░░
FORD         70,780.00 ▓░░░░
                       +-------------+-------------+-------------+-------------+
                       0          250,000       500,000       750,000  1,000,000

This example, with explanation, is available as a Jupyter notebook.

License

The MIT License

Copyright (c) 2015 Christopher Groskopf and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Indices and tables