Skip to main content

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 hashes)

Uploaded Source

Built Distribution

labcsv-1.0.4-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page