A simple package for processing data in the form of a table.
Project description
MYTABLE
A simple package for processing data in the form of a table.
Pay attention, all indexes starts from 0 instead of 1.
To install:
pip install mytable-lucien
To import:
import mytable
MYCSV
This is a simple reader and writer for CSV files by Lucien Shaw. It consumes less resource and processes more quickly than the current csv module, though a lot less functional.
It reads CSV files as plain texts and stores the table in a list, whose elements are lists of cells of the current row. The list is the value to the key 'full' of a dict, which is the returned value of the function.
Here is the guidance.
To import
from mytable import mycsv
Function: read()
Read a CSV file and store the table in a list.
- usage
res = mycsv.read(filname, delimiter=',')
- arguments
-
filename
A string value. The filename of the CSV file.
-
delimiter
A char value. Comma by default. The character which is used to delimit the columns.
-
- returned value
-
res
List of rows. Each row is a list of columns, aka. cells, which contains strings.
-
Function: write()
Create a CSV file.
- usage
mycsv.write(filename, table, delimiter=',')
-
arguments
-
filename
A string value. The filename of the CSV file be written.
-
table
A list, the structure of which is the same as the value to the key 'full' of the returned dict of function read().
All values shall be strings.
-
delimiter
A char value. Comma by default. The character which is used to delimit the columns.
-
-
returned value
There is no returned value.
MYTOOLS
Useful tools. Simple, but powerful.
To import
from mytable import mytools
Function: excel_ctn()
All functions of this package use numbers as indexes, but Excel uses alphabets as indications of the columns, such as 'A' for column 0 (We count from 0, remember?), 'Z' for column 25, and 'AA' for column 26.
This converts the alphabetical column Characters To pure Numbers.
- usage
res = mytools.excel_ctn(col)
-
arguments
-
col
Alphabetical column characters, such as 'A' or 'AA', etc.
-
-
returned value
A number, as mentioned above.
MYVIEW
Provide a better view of the tables.
To import
from mytable import myview
Function: view_range()
In some circumstances, there are so many columns that they cannot be fully displayed in excel, and columns that exceed the limit cannot be visualized.
This allows you to specify the columns and rows to be seen and extract them to a new temporary CSV file so that they can be seen with your favorite table viewer, like Excel.
- usage
myview.view_range(table, columns=[], rows=[], filename='TempMytableFile.csv')
- arguments
-
table
An original table in the form of a list.
-
columns
A list of column numbers that indicate the columns you would like to see. The default value is an empty list, which selects all columns.
-
rows
A list of row numbers that indicate the rows you would like to see. The default value is an empty list, which selects all rows.
-
filename
The name of the temporary file. The default value is 'TempMytableFile.csv'.
-
Function: select_range()
It is the same as function: view_range() but returns the selected table and does not generate the temporary file.
- usage
table_select = myview.select_range(table, columns=[], rows=[])
- arguments Same as function: view_range() but no argument: filename.
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
File details
Details for the file mytable-lucien-3.5.2.tar.gz
.
File metadata
- Download URL: mytable-lucien-3.5.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40e3c7bd4ed4f4cbf62352b8a2d32de4b079be393933ac5e7d39c137e2e58e7c |
|
MD5 | 5a4d0be6bfb2537bafef5610c2cf48c4 |
|
BLAKE2b-256 | 7624a69f2b30f01586c14498273b26de7405ec77e1ccde0403f735be8a582f87 |
File details
Details for the file mytable_lucien-3.5.2-py3-none-any.whl
.
File metadata
- Download URL: mytable_lucien-3.5.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df23d7d4c4323751a7744bb024fd5823bb745746e1b394efbca61735ad1aa678 |
|
MD5 | e505cef681ba44cc0c10f858a9e7179f |
|
BLAKE2b-256 | f2f83f61417ae18ad9338107d5eda850c4a1ebb0b6273e1ea15037d26b340485 |