A simple query interface for tabular data.
Project description
Squint is a simple query interface for tabular data that’s light-weight and easy to learn. A core feature of Squint is that the structure of a query’s selection determines the structure of its result. With it you can:
Select data using Python literals—sets, lists, dictionaries, etc.—and get results in the same format.
Aggregate, map, filter, reduce, and otherwise manipulate data.
Lazily iterate over results, write them to a file, or eagerly evaluate them in memory.
Analyze data from CSV, Excel, SQL, and other data sources.
- Documentation:
- https://squint.readthedocs.io/ (stable)
- Official:
- Development:
Some Examples
The examples below will query a CSV file containing the following data (example.csv):
A |
B |
C |
---|---|---|
x |
foo |
20 |
x |
foo |
30 |
y |
foo |
10 |
y |
bar |
20 |
z |
bar |
10 |
z |
bar |
10 |
To begin, we load the CSV file into a Select object:
import squint
select = squint.Select('example.csv')
When you select a |
The result contains a |
---|---|
single column
|
list of values from that column
|
tuple of columns
|
list of tuples with values from those columns
|
set of columns
|
list of sets with values from those columns
|
dictionary of columns
|
dictionary with keys and values from those columns
(Notice that values are grouped by matching key.) |
dictionary with a tuple of column values
|
dictionary with keys and tuples of values from those columns
|
dictionary with a tuple of column keys
|
dictionary with tuple keys and values from those columns
|
Installation
The Squint package is tested on Python 2.7, 3.4 through 3.8, PyPy, and PyPy3; and is freely available under the Apache License, version 2.
The easiest way to install squint is to use pip:
pip install squint
To upgrade an existing installation, use the “--upgrade” option:
pip install --upgrade squint
The development repository for squint is hosted on GitHub. If you need bug-fixes or features that are not available in the current stable release, you can “pip install” the development version directly from GitHub:
pip install --upgrade https://github.com/shawnbrown/squint/archive/master.zip
All of the usual caveats for a development install should apply—only use this version if you can risk some instability or if you know exactly what you’re doing. While care is taken to never break the build, it can happen.
Freely licensed under the Apache License, Version 2.0
Copyright 2015 - 2020 National Committee for an Effective Congress, et al.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file squint-0.1.0.tar.gz
.
File metadata
- Download URL: squint-0.1.0.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1010289f23be2b1e4e72cc919453589a585e0c8ce2718e5d65231783b393db02 |
|
MD5 | 39aae4ff0d43beebde52e33eae35a127 |
|
BLAKE2b-256 | d6cbcbb66ab5a4aef847c2a258a68500161f07e6ada382724a626f87130ae9f0 |
File details
Details for the file squint-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: squint-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 763e1bd3a596a1679c907f507b6a43f851f32330e5b58f5da9cac6de9b81d3b5 |
|
MD5 | ed60c3b45e99734ddeff6b3487029f5b |
|
BLAKE2b-256 | 522f259f65665a7d54d0b471d94f405f1b220d7855488c0d10bd1fe101017d5d |