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.1.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.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pzfx-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 824981865dcf1b984a7a6639731f1033200c4e5e4807f922b8aa15d1c4c1d687
MD5 9291b5468e5d60e905d8011e97f729ce
BLAKE2b-256 46f51bc516c4dcdde3d9364d45381930ea87749a1142f59939b0c7be1a7c014f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pzfx-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a8def93dcd9a12eec35c772a3933e62a96efd970f73673e2a746b1ba5845521
MD5 1b34f358bc1dcd15c5913f96d52432e4
BLAKE2b-256 fde61c4946ceaa0f59fb235f1a6495db4feebe7ceb62772f3419baf529fba3fc

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