Skip to main content

A simple tool for manipulating tabular data using Python expressions

Project description

pwk

Test Publish PyPI

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.2.0.tar.gz (4.8 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.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pwk-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for pwk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c9e974a3911950f56a2e4a6c9de011e190e104421ea6214dc33f63769abbf088
MD5 c262c152db14b52c86e908fe399b2643
BLAKE2b-256 913970c1d9294d610b71474134b600daded4aa08fcb3d38d80609bb36c1d45ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pwk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for pwk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fc03d10005377068127a7e03a02a27e626b09550e688537bc04568ac6ee01c5
MD5 2491cce8e10543d4c63f7206be160640
BLAKE2b-256 e61c730cd4df7846ff223fde2a6e5c519198be8c961ecd501c1b34869f1fdae0

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