Catalog PyPI
PACKAGE EXPLORERView in registry

aggnf

PyPI

aggnf: Aggregate Nth Field. A small console utility to count/group text data.

Versions collected1
Direct dependencies2From release 0.2.3
Last observed21 Oct, 09:03 UTC

README

Version 0.2.3 documentation
===============================
aggnf
===============================

.. image:: https://img.shields.io/travis/jwgalley/aggnf.svg
        :target: https://travis-ci.org/jwgalley/aggnf

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


aggnf: Aggregate Nth Field. A small console utility to count/group text data.



* Free software: MIT license
* Documentation: (COMING SOON!) https://aggnf.readthedocs.org.

Features
--------

Generates aggregate counts of text data, using a specified field as a key.

Fields can be delimited by any string, the default is consecutive whitespace.

Key field can be any integer, with negative integers counting backwards. The default is the last field.

How-To
--------

The ``--help`` option is descriptive::

    ~$ aggnf --help
    Usage: aggnf [OPTIONS] [IN_DATA]

      Group text data based on a Nth field, and print the aggregate result.

      Works like SQL:
          `select field, count(*) from tbl group by field`

      Or shell:
          `cat file | awk '{print $NF}' | sort | uniq -c`

      Arguments:
          IN_DATA   Input file, if blank, STDIN will be used.

    Options:
      -d, --sep TEXT          Field delimiter. Defaults to whitespace.
      -n, --fieldnum INTEGER  The field to use as the key, default: last field.
      -o, --sort              Sort result.
      -i, --ignore-err        Don't exit if field is specified and out of range.
      --help                  Show this message and exit.



Here we generate an example file of 1000 random numbers, and ask aggnf to group it for us, ordering the result by the most common occurrences::

    ~$ seq 1 1000 | while read -r l; do echo -e "line:${l}\t${RANDOM:0:1}"; done > rand.txt
    ~$ aggnf -o rand.txt
           1: 340
           2: 336
           3: 120
           8: 42
           6: 37
           5: 35
           7: 35
           4: 33
           9: 22


This might look familiar, as it's the same result one might get from something like ``select field,count(*) as count from table group by field order by count desc``, or even by the following bash one-liner::

    ~$ cat rand.txt | awk '{print $NF}' | sort | uniq -c | sort -nr
    340 1
    336 2
    120 3
     42 8
     37 6
     35 7
     35 5
     33 4
     22 9


To-Do
-----

1. Output is mangled when using another delimiter, will fix.
2. Add a ``--sum`` option, which will key on one field, and sum the contents of another.
3. Speed optimizations.

Notes
-----

The usefulness of this program is questionable. It's functionality is already covered by existing console commands that are much faster.

This project is merely a quick example to learn the basics of packages which are unfamiliar to me, namely: cookiecutter, tox, and click.





History
-------

April 4th: Released


Downloads & popularity

1downloads
1-day window · source-reported counts20 Oct 2026
52.50
2026-07-23: 3 · observed 2026-10-21T15:59:35.3700999Z · period 2026-07-23–2026-07-232026-07-27: 3 · observed 2026-10-21T15:59:35.3700999Z · period 2026-07-27–2026-07-272026-07-28: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-07-28–2026-07-282026-07-31: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-07-31–2026-07-312026-08-02: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-02–2026-08-022026-08-04: 3 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-04–2026-08-042026-08-08: 2 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-08–2026-08-082026-08-09: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-09–2026-08-092026-08-14: 3 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-14–2026-08-142026-08-15: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-15–2026-08-152026-08-17: 2 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-17–2026-08-172026-08-20: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-20–2026-08-202026-08-21: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-21–2026-08-212026-08-23: 3 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-23–2026-08-232026-08-24: 5 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-24–2026-08-242026-08-25: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-25–2026-08-252026-08-28: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-28–2026-08-282026-08-31: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-08-31–2026-08-312026-09-02: 2 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-02–2026-09-022026-09-07: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-07–2026-09-072026-09-10: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-10–2026-09-102026-09-14: 2 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-14–2026-09-142026-09-19: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-19–2026-09-192026-09-24: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-24–2026-09-242026-09-26: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-26–2026-09-262026-09-27: 3 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-27–2026-09-272026-09-30: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-09-30–2026-09-302026-10-02: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-02–2026-10-022026-10-05: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-05–2026-10-052026-10-06: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-06–2026-10-062026-10-09: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-09–2026-10-092026-10-11: 2 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-11–2026-10-112026-10-13: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-13–2026-10-132026-10-14: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-14–2026-10-142026-10-19: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-19–2026-10-192026-10-20: 1 · observed 2026-10-21T15:59:35.3700999Z · period 2026-10-20–2026-10-20
23 Jul20 Oct

pypistats · 36 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-20 – 2026-10-2012026-10-21T15:59:35.3700999Z
2026-10-19 – 2026-10-1912026-10-21T15:59:35.3700999Z
2026-10-14 – 2026-10-1412026-10-21T15:59:35.3700999Z
2026-10-13 – 2026-10-1312026-10-21T15:59:35.3700999Z
2026-10-11 – 2026-10-1122026-10-21T15:59:35.3700999Z
2026-10-09 – 2026-10-0912026-10-21T15:59:35.3700999Z
2026-10-06 – 2026-10-0612026-10-21T15:59:35.3700999Z
2026-10-05 – 2026-10-0512026-10-21T15:59:35.3700999Z
2026-10-02 – 2026-10-0212026-10-21T15:59:35.3700999Z
2026-09-30 – 2026-09-3012026-10-21T15:59:35.3700999Z
2026-09-27 – 2026-09-2732026-10-21T15:59:35.3700999Z
2026-09-26 – 2026-09-2612026-10-21T15:59:35.3700999Z
2026-09-24 – 2026-09-2412026-10-21T15:59:35.3700999Z
2026-09-19 – 2026-09-1912026-10-21T15:59:35.3700999Z
2026-09-14 – 2026-09-1422026-10-21T15:59:35.3700999Z
2026-09-10 – 2026-09-1012026-10-21T15:59:35.3700999Z
2026-09-07 – 2026-09-0712026-10-21T15:59:35.3700999Z
2026-09-02 – 2026-09-0222026-10-21T15:59:35.3700999Z
2026-08-31 – 2026-08-3112026-10-21T15:59:35.3700999Z
2026-08-28 – 2026-08-2812026-10-21T15:59:35.3700999Z
2026-08-25 – 2026-08-2512026-10-21T15:59:35.3700999Z
2026-08-24 – 2026-08-2452026-10-21T15:59:35.3700999Z
2026-08-23 – 2026-08-2332026-10-21T15:59:35.3700999Z
2026-08-21 – 2026-08-2112026-10-21T15:59:35.3700999Z
2026-08-20 – 2026-08-2012026-10-21T15:59:35.3700999Z
2026-08-17 – 2026-08-1722026-10-21T15:59:35.3700999Z
2026-08-15 – 2026-08-1512026-10-21T15:59:35.3700999Z
2026-08-14 – 2026-08-1432026-10-21T15:59:35.3700999Z
2026-08-09 – 2026-08-0912026-10-21T15:59:35.3700999Z
2026-08-08 – 2026-08-0822026-10-21T15:59:35.3700999Z
2026-08-04 – 2026-08-0432026-10-21T15:59:35.3700999Z
2026-08-02 – 2026-08-0212026-10-21T15:59:35.3700999Z
2026-07-31 – 2026-07-3112026-10-21T15:59:35.3700999Z
2026-07-28 – 2026-07-2812026-10-21T15:59:35.3700999Z
2026-07-27 – 2026-07-2732026-10-21T15:59:35.3700999Z
2026-07-23 – 2026-07-2332026-10-21T15:59:35.3700999Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.34 Apr 20182

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
jwgalley/aggnf

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:03 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:2ad47493fbe4e79eb7ebea2475e15a43ca0e638c06d77470b4cd9cb6b7228e4a