Skip to main content

A simple tool for manipulating tabular data using Python expressions

Project description

pwk

Test

pwk is a simple script to quickly process and reformat tabular data using Python expressions.

Inspired by AWK.

Requirements

  • Python >= 3.6

Installing

Download pwk.py and put it somewhere in your PATH.

You can use this command to download and install the script directly into /usr/local/bin:

curl 'https://raw.githubusercontent.com/saeub/pwk/main/pwk.py' > /usr/local/bin/pwk && chmod +x /usr/local/bin/pwk

Examples

$ cat prices_without_tax.csv
car,20000
bike,600
motorcycle,3000

$ pwk '_1.title(), _2*1.07' prices_without_tax.csv
Car     21400.0
Bike    642.0
Motorcycle      3210.0
$ cat shopping_list.csv
bread and butter,2.50,supermarket
"apples, pears and oranges",4.20,fruit store
chocolate,1.10,supermarket

$ pwk -s -i csv -o tsv '"$"+_2, _1' shopping_list.csv
$2.50   bread and butter
$4.20   apples, pears and oranges
$1.10   chocolate

Running tests

  • Install development dependencies: pip install -r dev-requirements.txt
  • Run tests: pytest test.py

Similar projects

The main advantage of this project is saving an "a" in the command.

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

pwk-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

pwk-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pwk-0.1.0.tar.gz.

File metadata

  • Download URL: pwk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pwk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5999816d1a79653ff5c60d52f039f82a21cc2ee9a826400aaf4e6a6b4fda8cf8
MD5 e715e824d5166abf65e0842314da277e
BLAKE2b-256 e1c59d88676ca5025d32005676b588fed7e7201204692cc2a0ae072669459067

See more details on using hashes here.

File details

Details for the file pwk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pwk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pwk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d3104d13f9a4835f50ab2ee6a5e60d6b84876b5685c805ac0a1765d722ccdfc
MD5 543e546b1b2f1853ffe01da8f0a824c4
BLAKE2b-256 87334aa27edd809f1500ee34988e00e38de50ffc8f14f3bd138c4be85c8cd6cc

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