Skip to main content

A tiny spreadsheet-like data structure and tool

Project description

tablet

Tablet is a module that supports spreadsheet-like operations on tiny text tables.

Dealing with those tiny tables or spreadsheets (usually in CSV/TSV formats) is a daily chore.

The goal of this project is to provide a light-weight and easy-to-use tool that can handle daily-routines of manipulating tabular text data.

Inside the module, a “Table” class was defined to support all kinds of spreadsheet/table-like operations:
  • tsv/csv input/output

  • adding/removing rows and columns

  • lookup a key or keys

  • iterating

  • slicing

  • searching

  • sorting

  • filtering

  • grouping

  • joining

  • aggregating

  • removing duplicates

  • and more

If you are handling larger and more complex tables, spreadsheets, or panels, I suggest you turn to pandas<http://pandas.pydata.org/>.

Getting Started

Supposing a given csv file named <demo.csv> looks like below:

Heat,Lane,LastName,FirstName,YOB,NOC,RT,Time
1,1,SILADJI,Caba,1990,SRB,0.69,27.89
1,2,SCOZZOLI,Fabio,1988,ITA,0.62,27.37
1,3,SNYDERS,Glenn,1987,NZL,0.66,27.64
1,4,MARKIC,Matjaz,1983,SLO,0.73,27.71
1,5,GANGLOFF,Mark,1982,USA,0.67,27.57
1,6,FELDWEHR,Hendrik,1986,GER,0.70,27.53
1,7,BARTUNEK,Petr,1991,CZE,0.64,27.87
1,8,POLYAKOV,Vladislav,1983,KAZ,0.77,27.81
2,1,RICKARD,Brenton,1983,AUS,0.71,27.80
2,2,AGACHE,Dragos,1984,ROU,0.76,27.71
2,3,DALE OEN,Alexander,1985,NOR,0.70,27.33
2,4,FRANCA DA SILVA,Felipe,1987,BRA,0.68,26.95
2,5,DUGONJIC,Damir,1988,SLO,0.75,27.51
2,6,VAN DER BURGH,Cameron,1988,RSA,0.63,26.90
2,7,TRIZNOV,Aleksandr,1991,RUS,0.70,27.73
2,8,STEKELENBURG,Lennart,1986,NED,0.69,27.51

Users can use the following statements to show the top 8 best-time results:

>>> import tablet as T
>>> t = T.read('demo.csv', delim=',').sort('Time')
>>> for row in t[:8]:
...     print row[2], row[3], row[-1]
...
VAN DER BURGH Cameron 26.90
FRANCA DA SILVA Felipe 26.95
DALE OEN Alexander 27.33
SCOZZOLI Fabio 27.37
DUGONJIC Damir 27.51
STEKELENBURG Lennart 27.51
FELDWEHR Hendrik 27.53
GANGLOFF Mark 27.57

And output the top 8 results to a new tsv (tab-separated values) file:

>>> t2 = t.cut_cols(['LastName','FirstName','Time']).cut_rows(range(8))
>>> t2.show()
H ['LastName', 'FirstName', 'Time']
0 ['VAN DER BURGH', 'Cameron', '26.90']
1 ['FRANCA DA SILVA', 'Felipe', '26.95']
2 ['DALE OEN', 'Alexander', '27.33']
3 ['SCOZZOLI', 'Fabio', '27.37']
4 ['DUGONJIC', 'Damir', '27.51']
5 ['STEKELENBURG', 'Lennart', '27.51']
6 ['FELDWEHR', 'Hendrik', '27.53']
7 ['GANGLOFF', 'Mark', '27.57']
>>> t2.write('finalists.tsv')

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

tablet-0.9.3.zip (12.9 kB view details)

Uploaded Source

Built Distribution

tablet-0.9.3.win32.exe (210.3 kB view details)

Uploaded Source

File details

Details for the file tablet-0.9.3.zip.

File metadata

  • Download URL: tablet-0.9.3.zip
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tablet-0.9.3.zip
Algorithm Hash digest
SHA256 019c952ffe917fa56c92764589f676db128611d29e3bb780658c40e043455d36
MD5 58a64b9005bb72da59f88037dbf6bc96
BLAKE2b-256 3020287216a24f6bb160039f57084263f24675c3da7a7107a49c1587e0d9e208

See more details on using hashes here.

File details

Details for the file tablet-0.9.3.win32.exe.

File metadata

  • Download URL: tablet-0.9.3.win32.exe
  • Upload date:
  • Size: 210.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tablet-0.9.3.win32.exe
Algorithm Hash digest
SHA256 bffde86427d7bda839c2a9e0814aca03c27e620e376728f5d15870ed678d3409
MD5 bdd6db44ef13bfb06d62f2727912686a
BLAKE2b-256 bb1bd856b9c7b592a2bc0e0d1c1c23e96ffbbc30027b774a843563e803808397

See more details on using hashes here.

Supported by

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