Skip to main content

Read and write GraphPad Prism .pzfx files

Project description

pzfx

A Python library to read and write GraphPad Prism .pzfx files. This is a vibe coding project that ports the functionality of the R pzfx package to Python.

Installation

pip install pzfx

Usage

Reading .pzfx files

from pzfx import read_pzfx, pzfx_tables

# List all tables in a file
tables = pzfx_tables("data.pzfx")
print(tables)  # ['Table 1', 'Table 2']

# Read the first table
df = read_pzfx("data.pzfx")

# Read a specific table by name
df = read_pzfx("data.pzfx", table="My Table")

# Read a specific table by index (1-based)
df = read_pzfx("data.pzfx", table=2)

# Handle excluded/stricken values
df = read_pzfx("data.pzfx", strike_action="exclude")  # Replace with NaN (default)
df = read_pzfx("data.pzfx", strike_action="keep")     # Keep the value
df = read_pzfx("data.pzfx", strike_action="star")     # Append "*" to value

Writing .pzfx files

import pandas as pd
from pzfx import write_pzfx

# Write a single DataFrame
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
write_pzfx(df, "output.pzfx")

# Write multiple tables
tables = {
    'Experiment 1': df1,
    'Experiment 2': df2
}
write_pzfx(tables, "output.pzfx")

# Write with X column
write_pzfx(df, "output.pzfx", x_col="Time")

# Write with row names
write_pzfx(df, "output.pzfx", row_names=True)

# Write with subcolumns (replicates)
write_pzfx(df, "output.pzfx", subcolumns=3, subcolumn_suffix="_[0-9]+$")

# Write excluded values (values ending with "*" are marked as excluded)
df = pd.DataFrame({'A': ['1', '2*', '3']})  # 2 will be excluded in Prism
write_pzfx(df, "output.pzfx")

Parameters

read_pzfx

  • path: Path to the .pzfx file
  • table: Table to read (name or 1-based index). Default: 1
  • strike_action: How to handle excluded values: "exclude", "keep", or "star"
  • date_x: How to handle date X columns: "numeric", "character", or "both"

write_pzfx

  • x: DataFrame or dict of DataFrames
  • path: Output file path
  • row_names: Include row names as row titles (default: True)
  • x_col: Column for X values (index or name)
  • x_err: Column for X error values
  • n_digits: Decimal places for numeric data (default: 2)
  • notes: Notes table(s) with 'Name' and 'Value' columns
  • subcolumns: Number of subcolumns, or "SDN" for mean/SD/N format
  • subcolumn_suffix: Regex to group columns into subcolumns

License

MIT License

See Also

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

pzfx-0.3.0.tar.gz (111.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pzfx-0.3.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file pzfx-0.3.0.tar.gz.

File metadata

  • Download URL: pzfx-0.3.0.tar.gz
  • Upload date:
  • Size: 111.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for pzfx-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8e163b72bd25ec900462db814acad8a211a533089772abcf79061dba52f0f164
MD5 4c812b7b6a1b624872f491aa97890a8e
BLAKE2b-256 396e03a5e469a766f6cf0f70c53c5d127b686e32d0946f06a3d7c64393bc6ff3

See more details on using hashes here.

File details

Details for the file pzfx-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pzfx-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for pzfx-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b87360b0f60f6f6220227d74577ed1fe4e44a7a0998d4fa8cdc6fe0c9af68717
MD5 cd5543fc588a66c12483f970bc527fe9
BLAKE2b-256 c2d52551733e21ffc49ac77ab4344bc50b850452e6ee1bf1af3dbc7e8a956281

See more details on using hashes here.

Supported by

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