Simple CLI tool to read tables via Pandas
If you're one of those guys who prefers to work from the command line and need to often quickly check out what's saved in a file (without the hassle of having to touch your mouse ... ) this could be a useful tool.
Read DataFrame (rdf) provides a simple command-line interface to read tables. It essentially replaces
import pandas as pd
df = pd.read_table(<yourfile>)
print(df)
with
$ rdf <yourfile>
Installation
pip install read-dataframe
Usage
Basic usage
To read a table, take for example the classical iris dataset
$ rdf irisdataset.csv --sep ','
sepal.length sepal.width petal.length petal.width variety
0 5.1 3.5 1.4 0.2 Setosa
1 4.9 3.0 1.4 0.2 Setosa
2 4.7 3.2 1.3 0.2 Setosa
3 4.6 3.1 1.5 0.2 Setosa
4 5.0 3.6 1.4 0.2 Setosa
.. ... ... ... ... ...
145 6.7 3.0 5.2 2.3 Virginica
146 6.3 2.5 5.0 1.9 Virginica
147 6.5 3.0 5.2 2.0 Virginica
148 6.2 3.4 5.4 2.3 Virginica
149 5.9 3.0 5.1 1.8 Virginica
[150 rows x 5 columns]
If for whatever reason you would like to set the column 'variety' to be the index column
$ rdf irisdataset.csv --sep ',' --index-col variety
sepal.length sepal.width petal.length petal.width
variety
Setosa 5.1 3.5 1.4 0.2
Setosa 4.9 3.0 1.4 0.2
Setosa 4.7 3.2 1.3 0.2
Setosa 4.6 3.1 1.5 0.2
Setosa 5.0 3.6 1.4 0.2
... ... ... ... ...
Virginica 6.7 3.0 5.2 2.3
Virginica 6.3 2.5 5.0 1.9
Virginica 6.5 3.0 5.2 2.0
Virginica 6.2 3.4 5.4 2.3
Virginica 5.9 3.0 5.1 1.8
[150 rows x 4 columns]
Want to have all 150 rows printed out? Try:
$ rdf irisdataset.csv --sep ',' --display-nrows all
More user interactive functions
Adding the option --list-columns would prompt the user to give the number of column headers to be printed out (from first to last column), and a similar option is available for the index via --list-indices
$ rdf irisdataset.csv --sep ',' --list-columns
sepal.length sepal.width petal.length petal.width variety
0 5.1 3.5 1.4 0.2 Setosa
1 4.9 3.0 1.4 0.2 Setosa
2 4.7 3.2 1.3 0.2 Setosa
3 4.6 3.1 1.5 0.2 Setosa
4 5.0 3.6 1.4 0.2 Setosa
.. ... ... ... ... ...
145 6.7 3.0 5.2 2.3 Virginica
146 6.3 2.5 5.0 1.9 Virginica
147 6.5 3.0 5.2 2.0 Virginica
148 6.2 3.4 5.4 2.3 Virginica
149 5.9 3.0 5.1 1.8 Virginica
[150 rows x 5 columns]
Number of columns to list (<int> or 'all'): 2
sepal.length
sepal.width
To print the Series 'petal.length', add the --print-col option, which will similarly prompt the user for a column of interest. Since the 'petal.length' column is 2nd column (counting from 0), inputing 2 would give the same results. Also, a similar option is available for the index via --print-index
$ rdf irisdataset.csv --sep ',' --print-col
sepal.length sepal.width petal.length petal.width variety
0 5.1 3.5 1.4 0.2 Setosa
1 4.9 3.0 1.4 0.2 Setosa
2 4.7 3.2 1.3 0.2 Setosa
3 4.6 3.1 1.5 0.2 Setosa
4 5.0 3.6 1.4 0.2 Setosa
.. ... ... ... ... ...
145 6.7 3.0 5.2 2.3 Virginica
146 6.3 2.5 5.0 1.9 Virginica
147 6.5 3.0 5.2 2.0 Virginica
148 6.2 3.4 5.4 2.3 Virginica
149 5.9 3.0 5.1 1.8 Virginica
[150 rows x 5 columns]
Column to print (<int> or <str>): petal.length
0 1.4
1 1.4
2 1.3
3 1.5
4 1.4
...
145 5.2
146 5.0
147 5.2
148 5.4
149 5.1
Name: petal.length, Length: 150, dtype: float64
Metadata
Release files for read-dataframe 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| read_dataframe-0.0.2.tar.gz | 4.4 kB | Without provenance | Details for read_dataframe-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| read_dataframe-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for read_dataframe-0.0.2-py3-none-any.whl |
Total release size: 9.2 kB
Release files / read_dataframe-0.0.2.tar.gz
| Download URL | read_dataframe-0.0.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d722e8025942540b351b3d22f03e2f252fd18c1b41837cb595355f000c2a562e
|
|
BLAKE2b-256 checksum How to use checksums |
ce5d56d0e699be1a6e118834e6a060fe0be9cb0257983383a01998125f6baa79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / read_dataframe-0.0.2-py3-none-any.whl
| Download URL | read_dataframe-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
959c21deb018bee8b21bd497308acf655dbe83b97ac8c446f63fefceac94c33f
|
|
BLAKE2b-256 checksum How to use checksums |
aa9c51e34e35bb3deebc7245d8261cf393a7a15d75bc66e8105750dc47a249a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for read-dataframe 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.