Skip to main content

extract insights from 2d tables

Project description

sheetcalc

Extract insights from two dimentional tables. Load data into table one by one, or in bulk using import features. Use grouping features to aggregate by one or more columns similar to SQL.

Import Package

from sheetcalc import Table

Create Table Instance

tbl = Table ('table-name', 'optional table description')

Create Columns

tbl.add_column ()
tbl.add_column ('Amt')

When no column name is supplied, a name will be autogenerated as 'Column_n' where 'n' is the Column number. Column names do not need to be pre-defined. Default names get generated dynamically when loading rows when a new column is detected.

Add Rows into Table

Add rows one at a time

tbl.add_row (['John', 100, 'Business'])
tbl.add_row (['Mary', 35,  'Personal'])
tbl.add_row (['Rob' , 2,   'Business'])
tbl.add_row (['John', 15,  'Personal'])
tbl.add_row (['Mary', 10,  'Personal'])
tbl.add_row (['Ken',  10])
tbl.add_row (['Ken',  10,  'Personal'])

or add rows from comma delimitted file with a header row

tbl.load_from_delimited_file ('/home/user/data.csv')

or from file delimitted by any char, e.g tab

tbl.load_from_delimited_file ('/home/user/data.csv', '\t')

or from a file without a header row

tbl.load_from_delimited_file ('/home/user/data.csv', ',', False)

Grouping Data and Aggregating Results

Group values by one or more columns

keymap, valuemap, skipped = tbl.group_by (
	'Column_1, Column_3',
	'Sum (Amt), min(Amt), count (Amt)'
)

Return values:

  • keymap Hashmap from system Generated hashkey to Grouping Values
  • valuemap Hashmap from system Generated hashkey to Aggretate results
  • skipped - Rows not included in the groping operation. This includes failed rows.

You can correlate the values between the two returned Hashmaps 'keymap' and 'valuemap' using their hashkeys. The hashkeys are simply comma separated values of data in Grouping Columns. Therefore, in case of Single Column Grouping (and other situations when a comma separated list is sufficient) you can safely discard the returned 'keymap' and use only 'valuemap'.

Supported Aggregation Functions

  • count
  • min
  • max
  • sum

Print Results and Statistics

Raw Print including Data

print (values)
or
print (json.dumps (valuemap, default=lambda o: o.__dict__, sort_keys=True, indent=4))

Print Processing Runtimes and other Statistics

print (tbl.stats)
or
print (json.dumps (tbl.stats, default=lambda o: o.__dict__, sort_keys=True, indent=4))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sheetcalc-0.1.5.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheetcalc-0.1.5-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file sheetcalc-0.1.5.tar.gz.

File metadata

  • Download URL: sheetcalc-0.1.5.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6

File hashes

Hashes for sheetcalc-0.1.5.tar.gz
Algorithm Hash digest
SHA256 085b42dc4b87e4c26c2a04787ae265dee2132d3fe2ffcd210cbd98c44f6ad826
MD5 c46b3e76c268683d1a9c16d306578dcf
BLAKE2b-256 91f730bf06d3e3b235ebd1a3631fc5899893827ce53b958e956bf857fe56add5

See more details on using hashes here.

File details

Details for the file sheetcalc-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: sheetcalc-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6

File hashes

Hashes for sheetcalc-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e0deb173e77e37f82ba0d2043c48342689bd59130afd584bb32a1d7e908d95b6
MD5 1870e6d58e06b31a421af11f4be81783
BLAKE2b-256 c0bab60feff14dbb574fdfd05a86fe57183cc06e1e5df89eaa68e13f1a7c3c21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page