Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

A tiny spreadsheet-like data structure and tool

Project description


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<>.

Getting Started

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

2,3,DALE OEN,Alexander,1985,NOR,0.70,27.33
2,4,FRANCA DA SILVA,Felipe,1987,BRA,0.68,26.95
2,6,VAN DER BURGH,Cameron,1988,RSA,0.63,26.90

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

>>> import tablet as T
>>> t ='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))
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

Release history Release notifications

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
tablet-0.9.3.win32.exe (210.3 kB) Copy SHA256 hash SHA256 Windows Installer any (12.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page