Get data column by column from the CSV file export by lab.js. Use Pandas.
Project description
labcsv.py
You can easily get the data you need columns from lab.js.csv!
Installation
pip install labcsv
How to Use
Read CSV
from labcsv import read_csv,DefaultHeaderName as LHName
rlab = read_csv("tests/test.csv") #<- path
Read columns as any type
- default: "001" -> 1.0
- str type: "001" -> "001"
rlab = read_csv("tests/test.csv",dtype={"Param2":str})
*"Param2" is a header name
*The specifications are the same as for pandas.
Get columns data
The return type is ndarry (get_column_values)
values = rlab.get_column_values(LHName.SENDER) #n×1 size
# or
values = rlab.get_column_values([LHName.SENDER,LHName.RESPONSE,LHName.DURATION]) # n×3 size
# or
values = rlab.get_column_values("Param1") #custom column name
# or
values = rlab.get_column_values([LHName.SENDER, "Param1"]) #multiple
The return type is list (get_column_list)
senders,time_commits = rlab.get_column_list([LHName.SENDER,LHName.TIME_COMMIT])
print(senders)
print(time_commits)
nan to Empty String
from labcsv import read_csv,DefaultHeaderName as LHName
rlab = read_csv("tests/test.csv")
rlab.pandas_data.fillna('', inplace=True) #<---
print(rlab.get_column_values("Param1"))
You can use pandas functions.
Get meta
meta = rlab.get_meta()
print(meta["labjs_version"])
print(meta["language"])
print(meta["location"])
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
labcsv-1.0.4.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file labcsv-1.0.4.tar.gz
.
File metadata
- Download URL: labcsv-1.0.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.11.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67dfb63124af19f3430a2e39b9075ecdc955ce577d0551e6ad9d1b36925f1291 |
|
MD5 | 05d7eaf223a056ebbb578f35a8a5ef9a |
|
BLAKE2b-256 | 61510567a8a0b74c4f354e35e824ae9bdb8b579656af5dc167e6068ab3d38e77 |
File details
Details for the file labcsv-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: labcsv-1.0.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.11.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7225f80903fb2abd76825dbbdc72d0fe8d2990fc38676072ec219d8c20a9cd3 |
|
MD5 | a397d6f59824de151fa8e0ea95b278e1 |
|
BLAKE2b-256 | 87a41ad5d715d6ad9ab11f6f323e871a7f768969067b1d84422f8dfeebaf9429 |