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 behavior 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/mamba 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")

Reading and writing compressed files is also supported, and done automatically based on the provided file extension:

import tfs

# Reading a compressed file is simple, compression format is inferred
df = tfs.read("path_to_input.tfs.gz")

# When writing choose the compression format by providing the appropriate file extension
tfs.write("path_to_output.tfs.bz2", df)
tfs.write("path_to_output.tfs.zip", df)

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.7.3.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

tfs_pandas-3.7.3-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tfs-pandas-3.7.3.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for tfs-pandas-3.7.3.tar.gz
Algorithm Hash digest
SHA256 9fc51e6d036d4a8da7970096c414d8c6b58b0adc97f28bbbf72abdec056c4d11
MD5 4d0fb7350faefe1eaaf3917064811815
BLAKE2b-256 7f5e79f0341c81632ad7023e50f2dd0e585b69465fee0b2616f69f2e381fc3cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tfs_pandas-3.7.3-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for tfs_pandas-3.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 00297587f724be2e3eed638e82014e1e9067415e0bbc6cf54f7f4cea6d0bbc9f
MD5 e6cfc4e333ed8ff407c2ad30bac23762
BLAKE2b-256 4f6bceb6b34481d0201822015835f0fe7d93f90055965fcf41413defd5464e44

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