Skip to main content

Read and write tfs files.

Project description

TFS-Pandas

Cron Testing Code Climate coverage Code Climate maintainability (percentage)

PyPI Version GitHub release Conda-forge Version DOI

This package provides reading and writing functionality for table format system (tfs) files. Files are read into a TfsDataFrame, a class built on top of the famous pandas.DataFrame, which in addition to the normal behaviour attaches an OrderedDict of headers to the DataFrame.

See the API documentation for details.

Installing

Installation is easily done via pip:

python -m pip install tfs-pandas

One can also install in a conda environment via the conda-forge channel with:

conda install -c conda-forge tfs-pandas

Example Usage

The package is imported as tfs, and exports top-level functions for reading and writing:

import tfs

# Loading a TFS file is simple
data_frame = tfs.read("path_to_input.tfs", index="index_column")

# You can access and modify the headers with the .headers attribute
useful_variable = data_frame.headers["SOME_KEY"]
data_frame.headers["NEW_KEY"] = some_variable

# Manipulate data as you do with pandas DataFrames
data_frame["NEWCOL"] = data_frame.COL_A * data_frame.COL_B

# You can check the validity of a TfsDataFrame, and choose the behavior in case of errors
tfs.frame.validate(data_frame, non_unique_behavior="raise")  # or choose "warn"

# Writing out to disk is simple too
tfs.write("path_to_output.tfs", data_frame, save_index="index_column")

It also provides some tools to validate and manipulate TfsDataFrames and their headers; or lazily manage a collection of TFS files. With tfs.read_hdf() and tfs.write_hdf() the TfsDataFames can also be saved as hdf5 files, if the hdf5 extra-requirements are fullfilled.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

tfs-pandas-3.3.1.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

tfs_pandas-3.3.1-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file tfs-pandas-3.3.1.tar.gz.

File metadata

  • Download URL: tfs-pandas-3.3.1.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.15

File hashes

Hashes for tfs-pandas-3.3.1.tar.gz
Algorithm Hash digest
SHA256 cdff9babdea457ed5d772df981af1cab8ac75a9024bdfaf49af8f34990391de3
MD5 a7a164486c0f3476fb5ea7de1199024f
BLAKE2b-256 6853b5e1431fd932b62c08fcd991f8502f6e463f2fb52d7c10b0ee3f15324726

See more details on using hashes here.

File details

Details for the file tfs_pandas-3.3.1-py3-none-any.whl.

File metadata

  • Download URL: tfs_pandas-3.3.1-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.15

File hashes

Hashes for tfs_pandas-3.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10d1c728224170ef9d7a4dcb9a9e8e452ca84f329032cb7cf37eb929f125be36
MD5 affae3344d1da18fc2cead6e3894cb18
BLAKE2b-256 22928cc041f4b5d68c0e872a1af943af5e8a86f185ed55b724956416cef81169

See more details on using hashes here.

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