Skip to main content

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')

Release files for tablet 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tablet 0.9.3
File Size Uploaded
tablet-0.9.3.zip 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tablet 0.9.3
File Interpreter ABI Platform
tablet-0.9.3.win32.exe Details

Total release size: 223.2 kB

Release files / tablet-0.9.3.zip

Download URL tablet-0.9.3.zip
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
019c952ffe917fa56c92764589f676db128611d29e3bb780658c40e043455d36
BLAKE2b-256 checksum
How to use checksums
3020287216a24f6bb160039f57084263f24675c3da7a7107a49c1587e0d9e208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / tablet-0.9.3.win32.exe

Download URL tablet-0.9.3.win32.exe
Size 210.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bffde86427d7bda839c2a9e0814aca03c27e620e376728f5d15870ed678d3409
BLAKE2b-256 checksum
How to use checksums
bb1bd856b9c7b592a2bc0e0d1c1c23e96ffbbc30027b774a843563e803808397
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page