Skip to main content

Scripts to use for pyarrow feather files in a Linux terminal window

Project description

Description

Stand-alone Unix shell command line tools for Apache's .feather formatted files:

- fless
- ftail
- fwc (-l)
- f2csv

Each tool operates in the spirit of the analogous Unix shell command. Only the most basic uses of these original Unix tools are suported in their f version. For example, the fwc command operates like wc -l, i.e. it displays the number of data rows. But wc -c is not provided.

Installation:

- Create virtual environment if desired
- pip install feather-tools
- pip install .

The files will be in .../site-packages/feather_tools. For convenience, you might add that location to $PATH.

Usage:

fless

fless <fpath>

Shows one screenful of the .feather file at a time. The number of rows displayed is determined by the terminal in which the command is issued. At the end of each displayed page, type a single character:

  • To show the next page: spacebar, or \n, or the character n
  • Back one page: b
  • Back to beginning (page 0): s
  • To the last page: e
  • For help: h
  • To quit the display: q

ftail <fpath> [(-n | --lines) n]

Displays the last n rows of the .feather file. Default is the lesser of 10, and the length of the data.

NOTE: Starts the row display with the logical (i.e. terminal-height) page that contains the first line specified by the tail default or in the --lines argument. So a few more rows than requested may be displayed at the top.

fwc <fpath>

Is analogout to the Unix wc -l, and shows the number of data rows, not counting the column header.

f2csv <src-fpath> [<dst-fpath>]

Writes a .csv file that contains the .feather data. Default separator is comma. Default output is stdout.

The command line arguments are as in the Pandas df.to_csv() documentation. This means that the index keyword is True by default, while index_label is None. Which leads to ugly .csv like:

,foo,bar,fum
Row0,1,2,3
Row1,4,5,6
Row2,7,8,9

Where the Rown are the dataframe index. Note the orphan comma in the header. To fix (same as with df.to_csv()):

f2csv --index=true --index_label=Rows file.feather

Rows,foo,bar,fum
Row0,1,2,3
Row1,4,5,6
Row2,7,8,9

or:

f2csv --index=false file.feather

foo,bar,fum
1,2,3
4,5,6
7,8,9

If you clone this repo to make changes: all Python imports are relative to <proj-root>/src. So ensure that your $PYTHONPATH includes that directory.

Testing

Running nose2 in the project root runs the tests. One abnormality: in order to blend with Unix convention, the command files are without a '.py' extension. Examples: fless, fwc. The downside is that unittest files cannot load Python files without .py extensions. Copies of the command files are therefore placed in the test subdirectory. The unittests run on those copies. If changes are made to the command files, then those copies must be updated before testing. Symlinks are not an option, because pip cannot recreate them during installation.

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

feather_tools-1.0.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

feather_tools-1.0.0-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file feather_tools-1.0.0.tar.gz.

File metadata

  • Download URL: feather_tools-1.0.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for feather_tools-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f3ef1fbe9f9c23784737eaa41a28b2167f7492b1e3ca51cf485e4902743b0dba
MD5 798f48cecb7a96f8c64c3c33d6f74204
BLAKE2b-256 1a73e5e79944461a221284110994e36fb67ef05c55e6bbd7c3b3ab5c8ca5b0b5

See more details on using hashes here.

File details

Details for the file feather_tools-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: feather_tools-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for feather_tools-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8659d17b404f653318f65bb85295a2405d3b177e40f22e1a74ed26a6b0edfb6
MD5 98d77b00fc5198a73162ff52656cbc90
BLAKE2b-256 1d62ec05176380fbad1e715842d01d30bde7e36f0c0fb94b033dad199b1a6170

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