canonical-transformer


Namecanonical-transformer JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/nailen1/canonical_transformer.git
SummaryA Python module for preserving structural isomorphisms across data transformations, ensuring reversible and type-stable conversions between formats like DataFrame, JSON, and dict.
upload_time2025-07-22 05:53:30
maintainerNone
docs_urlNone
authorJune Young Park
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements numpy pandas python-dateutil pytz typing_extensions deepdiff
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Canonical Transformer v1.0.0

A Python module for ensuring **structural isomorphism** and **commutative consistency** across data transformations.  
This toolkit provides mathematically reversible mappings between `pandas.DataFrame`, `dict`, `CSV`, and `JSON` formats—preserving data structure, types, and semantics regardless of transformation order.

---

## Features

### Isomorphism Guarantees

- **Bijective Mappings**: Each transformation has a unique and total inverse
- **Structure Integrity**: Index, column types, and ordering are preserved
- **Semantic Equivalence**: Original data meaning remains unchanged

### Commutative Transformations

- **Order-Invariance**: `A → B → C` ≡ `A → C → B`
- **Round-trip Identity**: `T⁻¹ ∘ T(x) = x` for all supported types
- **Transformation Algebra**: Composition, associativity, identity supported

### Supported Formats

- `pandas.DataFrame` ↔ `dict` ↔ `CSV` ↔ `JSON`
- Full interoperability under unified transformation rules
- Automatic type casting and structural validation

---

## Core Capabilities

```
df → dict → csv → json → df      # Exact round-trip equivalence
dict → csv → json → df → dict   # Commutative, isomorphic recovery
```

These transformations preserve:

- Data fidelity (values and types)
- Index and column structure
- Missing value handling (e.g., NaN ≈ None)

---

## Installation

```
pip install canonical-transformer==1.0.0
```

---

## Quick Start

```python
from canonical_transformer import *

df = pd.DataFrame({
    'id': [1, 2, 3],
    'name': ['Alice', 'Bob', 'Charlie'],
    'value': [10.5, -20.3, 30.0]
})

# Commutative round-trip transformation
df2 = map_json_to_df(
           map_csv_to_json(
               map_data_to_csv(
                   map_df_to_data(df), '.', 'out.csv'
               ), '.', 'out.csv'))

assert df.equals(df2)  # True
```

---

## Mathematical Properties

### Isomorphism

- **Injectivity**: Each input maps to a unique output
- **Surjectivity**: All outputs can be traced back to inputs
- **Bijectivity**: Reversible one-to-one mapping

### Commutativity

- **Order Independence**: Transformations commute
- **Associativity**: Grouping doesn’t affect result
- **Identity**: `T⁻¹ ∘ T = id`

### Homomorphism

- **Structure Preservation**: Index, type, ordering maintained
- **Format Standardization**: Consistent formatting across outputs

---

## 📦 Requirements

- Python >= 3.6
- pandas >= 2.2.3
- python-dateutil >= 2.9.0
- pytz >= 2024.2
- typing_extensions >= 4.12.2

---

## 📈 Version History

### v1.0.0

- Structural isomorphism guaranteed
- Bidirectional reversible transformations
- Full commutative consistency
- Format and type standardization

### v0.2.x

- Number formatting utilities
- Sign-preserving float formatting

---

## 👤 Author

**June Young Park**  
AI Systems Architect @ LIFE Asset Management  
📧 juneyoungpaak@gmail.com  
📍 TWO IFC, Yeouido, Seoul

> LIFE Asset Management is a hedge fund management firm that integrates value investing and engagement strategies with quantitative modeling and AI infrastructure.

---

## 📖 License

MIT License – see `LICENSE` file for details.

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nailen1/canonical_transformer.git",
    "name": "canonical-transformer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "June Young Park",
    "author_email": "juneyoungpaak@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3d/c7/bc1f2cbbf55ff3f88ebd9be7149df2b842c320bd9b70858823c0f8dc8b4f/canonical_transformer-1.0.5.tar.gz",
    "platform": null,
    "description": "# Canonical Transformer v1.0.0\n\nA Python module for ensuring **structural isomorphism** and **commutative consistency** across data transformations.  \nThis toolkit provides mathematically reversible mappings between `pandas.DataFrame`, `dict`, `CSV`, and `JSON` formats\u2014preserving data structure, types, and semantics regardless of transformation order.\n\n---\n\n## Features\n\n### Isomorphism Guarantees\n\n- **Bijective Mappings**: Each transformation has a unique and total inverse\n- **Structure Integrity**: Index, column types, and ordering are preserved\n- **Semantic Equivalence**: Original data meaning remains unchanged\n\n### Commutative Transformations\n\n- **Order-Invariance**: `A \u2192 B \u2192 C` \u2261 `A \u2192 C \u2192 B`\n- **Round-trip Identity**: `T\u207b\u00b9 \u2218 T(x) = x` for all supported types\n- **Transformation Algebra**: Composition, associativity, identity supported\n\n### Supported Formats\n\n- `pandas.DataFrame` \u2194 `dict` \u2194 `CSV` \u2194 `JSON`\n- Full interoperability under unified transformation rules\n- Automatic type casting and structural validation\n\n---\n\n## Core Capabilities\n\n```\ndf \u2192 dict \u2192 csv \u2192 json \u2192 df      # Exact round-trip equivalence\ndict \u2192 csv \u2192 json \u2192 df \u2192 dict   # Commutative, isomorphic recovery\n```\n\nThese transformations preserve:\n\n- Data fidelity (values and types)\n- Index and column structure\n- Missing value handling (e.g., NaN \u2248 None)\n\n---\n\n## Installation\n\n```\npip install canonical-transformer==1.0.0\n```\n\n---\n\n## Quick Start\n\n```python\nfrom canonical_transformer import *\n\ndf = pd.DataFrame({\n    'id': [1, 2, 3],\n    'name': ['Alice', 'Bob', 'Charlie'],\n    'value': [10.5, -20.3, 30.0]\n})\n\n# Commutative round-trip transformation\ndf2 = map_json_to_df(\n           map_csv_to_json(\n               map_data_to_csv(\n                   map_df_to_data(df), '.', 'out.csv'\n               ), '.', 'out.csv'))\n\nassert df.equals(df2)  # True\n```\n\n---\n\n## Mathematical Properties\n\n### Isomorphism\n\n- **Injectivity**: Each input maps to a unique output\n- **Surjectivity**: All outputs can be traced back to inputs\n- **Bijectivity**: Reversible one-to-one mapping\n\n### Commutativity\n\n- **Order Independence**: Transformations commute\n- **Associativity**: Grouping doesn\u2019t affect result\n- **Identity**: `T\u207b\u00b9 \u2218 T = id`\n\n### Homomorphism\n\n- **Structure Preservation**: Index, type, ordering maintained\n- **Format Standardization**: Consistent formatting across outputs\n\n---\n\n## \ud83d\udce6 Requirements\n\n- Python >= 3.6\n- pandas >= 2.2.3\n- python-dateutil >= 2.9.0\n- pytz >= 2024.2\n- typing_extensions >= 4.12.2\n\n---\n\n## \ud83d\udcc8 Version History\n\n### v1.0.0\n\n- Structural isomorphism guaranteed\n- Bidirectional reversible transformations\n- Full commutative consistency\n- Format and type standardization\n\n### v0.2.x\n\n- Number formatting utilities\n- Sign-preserving float formatting\n\n---\n\n## \ud83d\udc64 Author\n\n**June Young Park**  \nAI Systems Architect @ LIFE Asset Management  \n\ud83d\udce7 juneyoungpaak@gmail.com  \n\ud83d\udccd TWO IFC, Yeouido, Seoul\n\n> LIFE Asset Management is a hedge fund management firm that integrates value investing and engagement strategies with quantitative modeling and AI infrastructure.\n\n---\n\n## \ud83d\udcd6 License\n\nMIT License \u2013 see `LICENSE` file for details.\n\n---\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python module for preserving structural isomorphisms across data transformations, ensuring reversible and type-stable conversions between formats like DataFrame, JSON, and dict.",
    "version": "1.0.5",
    "project_urls": {
        "Homepage": "https://github.com/nailen1/canonical_transformer.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f62f0625b7b1146bd54ede72defd3d1be04732d6161cc55191a523ca26a6681",
                "md5": "b6ef81310cb5c429fca41f30b4f204b1",
                "sha256": "21573ab4208b733db67dbd2eacda8bde7afb8423e43e281f8e3d297ae4510911"
            },
            "downloads": -1,
            "filename": "canonical_transformer-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b6ef81310cb5c429fca41f30b4f204b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 25464,
            "upload_time": "2025-07-22T05:53:28",
            "upload_time_iso_8601": "2025-07-22T05:53:28.908737Z",
            "url": "https://files.pythonhosted.org/packages/0f/62/f0625b7b1146bd54ede72defd3d1be04732d6161cc55191a523ca26a6681/canonical_transformer-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3dc7bc1f2cbbf55ff3f88ebd9be7149df2b842c320bd9b70858823c0f8dc8b4f",
                "md5": "a6d8014b722dbff793eb387f7aa849ef",
                "sha256": "8678182c6483ea8bc835c457513f1935099a861dcd401f0e48b9ed6318696365"
            },
            "downloads": -1,
            "filename": "canonical_transformer-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a6d8014b722dbff793eb387f7aa849ef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 24265,
            "upload_time": "2025-07-22T05:53:30",
            "upload_time_iso_8601": "2025-07-22T05:53:30.355841Z",
            "url": "https://files.pythonhosted.org/packages/3d/c7/bc1f2cbbf55ff3f88ebd9be7149df2b842c320bd9b70858823c0f8dc8b4f/canonical_transformer-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-22 05:53:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nailen1",
    "github_project": "canonical_transformer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "2.1.3"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    ">=",
                    "2.9.0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    ">=",
                    "2024.2"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    ">=",
                    "4.12.2"
                ]
            ]
        },
        {
            "name": "deepdiff",
            "specs": [
                [
                    ">=",
                    "8.5.0"
                ]
            ]
        }
    ],
    "lcname": "canonical-transformer"
}
        
Elapsed time: 0.94849s