Scripts to use for pyarrow feather files in a Linux terminal window
Project description
Command Line Tools for Apache Feather Files
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
The recommended installation is via pipx, which is designed to install shell level command line tools. It will create a $HOME/.local/bin directory if it does not exist. The commands fless, ftail, etc. will reside there. The pipx installation offers to add the location to the OS PATH by adding an entry in the shell config file.
- pip install pipx
- pipx install feather-tools
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
To test the code, clone this repo, and install the test dependency:
pip install .[test]
pytest
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file feather_tools-1.1.0.tar.gz.
File metadata
- Download URL: feather_tools-1.1.0.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a92c866216637db50852ded3ee58fe319121a1ad8b6f1a2ee4b8aa41c03994cb
|
|
| MD5 |
dead6cb54d3cf58315dbbf9dee54d469
|
|
| BLAKE2b-256 |
050f64c9aea004186966a4b283aa446b9b11954af747faf6933d4fcf949989ff
|
File details
Details for the file feather_tools-1.1.0-py3-none-any.whl.
File metadata
- Download URL: feather_tools-1.1.0-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d624e86a802184e0ac3d2990dc5dea52e5eaf7932e49994b1b71e4fbc7a725af
|
|
| MD5 |
1764b5da9a1e8f74b4d862b728d47d04
|
|
| BLAKE2b-256 |
0e3742ebbed77116709ce9b7ae307709ce3d353eb96aa75c77548f13ac145817
|