partridge


Namepartridge JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/remix/partridge
SummaryPartridge is python library for working with GTFS feeds using pandas DataFrames.
upload_time2017-10-12 15:32:14
maintainer
docs_urlNone
authorDanny Whalen
requires_python
licenseMIT license
keywords partridge
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            =========
Partridge
=========


.. image:: https://img.shields.io/pypi/v/partridge.svg
        :target: https://pypi.python.org/pypi/partridge

.. image:: https://img.shields.io/travis/remix/partridge.svg
        :target: https://travis-ci.org/remix/partridge


Partridge is python library for working with
`GTFS <https://developers.google.com/transit/gtfs/>`__ feeds using
`pandas <https://pandas.pydata.org/>`__ DataFrames.

The implementation of Partridge is heavily influenced by our experience
at `Remix <https://www.remix.com/>`__ ingesting, analyzing, and
debugging thousands of GTFS feeds from hundreds of agencies.

At the core of Partridge is a dependency graph rooted at ``trips.txt``.
When reading the contents of a feed, disconnected data is pruned away
according to this graph. The root node can optionally be filtered to
create a view of the feed specific to your needs. It's most common to
filter a feed down to specific dates (``service_id``), routes
(``route_id``), or both.

.. figure:: dependency-graph.png
   :alt: dependency graph


Usage
-----

.. code:: python

    import datetime
    import partridge as ptg

    path = 'path/to/sfmta-2017-08-22.zip'

    service_ids_by_date = ptg.read_service_ids_by_date(path)

    feed = ptg.feed(path, view={
        'trips.txt': {
            'service_id': service_ids_by_date[datetime.date(2017, 9, 25)],
            'route_id': '12300', # 18-46TH AVENUE
        },
    })

    assert set(feed.trips.service_id) == service_ids_by_date[datetime.date(2017, 9, 25)]
    assert list(feed.routes.route_id) == ['12300']

    # Buses running the 18 - 46th Ave line use 88 stops (on September 25, 2017, at least).
    assert len(feed.stops) == 88

Features
--------

-  Surprisingly fast :)
-  Load only what you need into memory
-  Built-in support for resolving calendar days
-  Built on pandas DataFrames
-  Easily extended to support fields and files outside the official spec
   (TODO: document this)
-  Handle nested folders and bad data in zips
-  Predictable type conversions, by default

Installation
------------

.. code:: console

    pip install partridge

Thank You
---------

I hope you find this library useful. If you have suggestions for
improving Partridge, please open an `issue on
GitHub <https://github.com/remix/partridge/issues>`__.


=======
History
=======


0.3.0 (2017-10-12)
===================

* Fix service date resolution for raw_feed. Previously raw_feed considered all days of the week from calendar.txt to be active regardless of 0/1 value.


0.2.0 (2017-09-30)
===================

* Add missing edge from fare_rules.txt to routes.txt in default dependency graph.


0.1.0 (2017-09-23)
------------------

* First release on PyPI.

            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "partridge", 
    "upload_time": "2017-10-12 15:32:14", 
    "author": "Danny Whalen", 
    "home_page": "https://github.com/remix/partridge", 
    "github_user": "remix", 
    "download_url": "https://pypi.python.org/packages/8f/f8/5511ed018c385cf3dd5f4525f313a02488b90d235c65c95cadaf02ad8b6d/partridge-0.3.0.tar.gz", 
    "platform": "", 
    "version": "0.3.0", 
    "cheesecake_documentation_id": null, 
    "description": "=========\nPartridge\n=========\n\n\n.. image:: https://img.shields.io/pypi/v/partridge.svg\n        :target: https://pypi.python.org/pypi/partridge\n\n.. image:: https://img.shields.io/travis/remix/partridge.svg\n        :target: https://travis-ci.org/remix/partridge\n\n\nPartridge is python library for working with\n`GTFS <https://developers.google.com/transit/gtfs/>`__ feeds using\n`pandas <https://pandas.pydata.org/>`__ DataFrames.\n\nThe implementation of Partridge is heavily influenced by our experience\nat `Remix <https://www.remix.com/>`__ ingesting, analyzing, and\ndebugging thousands of GTFS feeds from hundreds of agencies.\n\nAt the core of Partridge is a dependency graph rooted at ``trips.txt``.\nWhen reading the contents of a feed, disconnected data is pruned away\naccording to this graph. The root node can optionally be filtered to\ncreate a view of the feed specific to your needs. It's most common to\nfilter a feed down to specific dates (``service_id``), routes\n(``route_id``), or both.\n\n.. figure:: dependency-graph.png\n   :alt: dependency graph\n\n\nUsage\n-----\n\n.. code:: python\n\n    import datetime\n    import partridge as ptg\n\n    path = 'path/to/sfmta-2017-08-22.zip'\n\n    service_ids_by_date = ptg.read_service_ids_by_date(path)\n\n    feed = ptg.feed(path, view={\n        'trips.txt': {\n            'service_id': service_ids_by_date[datetime.date(2017, 9, 25)],\n            'route_id': '12300', # 18-46TH AVENUE\n        },\n    })\n\n    assert set(feed.trips.service_id) == service_ids_by_date[datetime.date(2017, 9, 25)]\n    assert list(feed.routes.route_id) == ['12300']\n\n    # Buses running the 18 - 46th Ave line use 88 stops (on September 25, 2017, at least).\n    assert len(feed.stops) == 88\n\nFeatures\n--------\n\n-  Surprisingly fast :)\n-  Load only what you need into memory\n-  Built-in support for resolving calendar days\n-  Built on pandas DataFrames\n-  Easily extended to support fields and files outside the official spec\n   (TODO: document this)\n-  Handle nested folders and bad data in zips\n-  Predictable type conversions, by default\n\nInstallation\n------------\n\n.. code:: console\n\n    pip install partridge\n\nThank You\n---------\n\nI hope you find this library useful. If you have suggestions for\nimproving Partridge, please open an `issue on\nGitHub <https://github.com/remix/partridge/issues>`__.\n\n\n=======\nHistory\n=======\n\n\n0.3.0 (2017-10-12)\n===================\n\n* Fix service date resolution for raw_feed. Previously raw_feed considered all days of the week from calendar.txt to be active regardless of 0/1 value.\n\n\n0.2.0 (2017-09-30)\n===================\n\n* Add missing edge from fare_rules.txt to routes.txt in default dependency graph.\n\n\n0.1.0 (2017-09-23)\n------------------\n\n* First release on PyPI.\n", 
    "tox": true, 
    "lcname": "partridge", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": false, 
    "name": "partridge", 
    "license": "MIT license", 
    "travis_ci": true, 
    "github_project": "partridge", 
    "summary": "Partridge is python library for working with GTFS feeds using pandas DataFrames.", 
    "split_keywords": [
        "partridge"
    ], 
    "author_email": "daniel.r.whalen@gmail.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-10-12T15:32:19", 
            "comment_text": "", 
            "python_version": "3.6", 
            "url": "https://pypi.python.org/packages/62/71/30f7ca11ad920a27c1dc4bef4f5a748fada101c5f249c45516d2f1d2b60b/partridge-0.3.0-py2.py3-none-any.whl", 
            "md5_digest": "3208e74ed44ea826dbbb85b4a866772b", 
            "downloads": 0, 
            "filename": "partridge-0.3.0-py2.py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "62/71/30f7ca11ad920a27c1dc4bef4f5a748fada101c5f249c45516d2f1d2b60b/partridge-0.3.0-py2.py3-none-any.whl", 
            "size": 9941
        }, 
        {
            "has_sig": false, 
            "upload_time": "2017-10-12T15:32:14", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/8f/f8/5511ed018c385cf3dd5f4525f313a02488b90d235c65c95cadaf02ad8b6d/partridge-0.3.0.tar.gz", 
            "md5_digest": "78a1e5513c6206e762aa3f8d5ad8b204", 
            "downloads": 0, 
            "filename": "partridge-0.3.0.tar.gz", 
            "packagetype": "sdist", 
            "path": "8f/f8/5511ed018c385cf3dd5f4525f313a02488b90d235c65c95cadaf02ad8b6d/partridge-0.3.0.tar.gz", 
            "size": 319274
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}