From db82ec69a2e96f2e7089a931842b1560b1e95a37 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:16:09 -0400 Subject: [PATCH] docs: Fix Sum(), closes #28 --- docs/tutorial.rst | 12 ++++++------ example.py | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index b659e90..edeb556 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -82,9 +82,9 @@ The emissions dataset includes data for several states. We'll look at the states days = emissions.group_by('day', key_type=agate.Number()) day_totals = days.aggregate([ - ('so2', agate.Sum(), 'so2'), - ('co2', agate.Sum(), 'co2'), - ('nox', agate.Sum(), 'nox') + ('so2', agate.Sum('so2')), + ('co2', agate.Sum('co2')), + ('nox', agate.Sum('nox')) ]) The :code:`day_totals` table now contains total counts of each type of emission. Note that we don't know if this data is comprehensive so we shouldn't assume these are national totals. (In fact, I know that they aren't for reasons that will become obvious shortly.) @@ -120,9 +120,9 @@ You may also want to render charts that compare to series of data. For instance, states = emissions.group_by('State') state_totals = states.aggregate([ - ('so2', agate.Sum(), 'so2'), - ('co2', agate.Sum(), 'co2'), - ('noX', agate.Sum(), 'noX') + ('so2', agate.Sum('so2')), + ('co2', agate.Sum('co2')), + ('noX', agate.Sum('noX')) ]) state_totals.bar_chart('State', ['so2', 'noX']) diff --git a/example.py b/example.py index 5e666d2..30cb643 100755 --- a/example.py +++ b/example.py @@ -29,9 +29,9 @@ states = emissions.group_by('State') state_totals = states.aggregate([ - ('so2', agate.Sum(), 'so2'), - ('co2', agate.Sum(), 'co2'), - ('noX', agate.Sum(), 'noX') + ('so2', agate.Sum('so2')), + ('co2', agate.Sum('co2')), + ('noX', agate.Sum('noX')) ]) new_york = states['NY'] @@ -39,16 +39,16 @@ # NB: key_type shouldn't be necessary--agate bug #234 days = emissions.group_by('day', key_type=agate.Number()) day_totals = days.aggregate([ - ('so2', agate.Sum(), 'so2'), - ('co2', agate.Sum(), 'co2'), - ('noX', agate.Sum(), 'noX') + ('so2', agate.Sum('so2')), + ('co2', agate.Sum('co2')), + ('noX', agate.Sum('noX')) ]) dates = emissions.group_by(' Date', key_type=agate.Date('%Y-%m-%d')) date_totals = dates.aggregate([ - ('so2', agate.Sum(), 'so2'), - ('co2', agate.Sum(), 'co2'), - ('noX', agate.Sum(), 'noX') + ('so2', agate.Sum('so2')), + ('co2', agate.Sum('co2')), + ('noX', agate.Sum('noX')) ]) print('Simple charts')