Skip to main content

Package short description.

Project description

Documentation Status https://github.com/MacHu-GWU/jsonpolars-project/actions/workflows/main.yml/badge.svg https://codecov.io/gh/MacHu-GWU/jsonpolars-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/jsonpolars.svg https://img.shields.io/pypi/l/jsonpolars.svg https://img.shields.io/pypi/pyversions/jsonpolars.svg https://img.shields.io/badge/Release_History!--None.svg?style=social https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
https://img.shields.io/badge/Link-Document-blue.svg https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to jsonpolars Documentation

https://jsonpolars.readthedocs.io/en/latest/_static/jsonpolars-logo.png

jsonpolars is an innovative Python library designed to bridge the gap between JSON-based data manipulation syntax and the powerful Polars data processing library. This project aims to provide a flexible and intuitive way to express Polars operations using JSON structures, making it easier for developers to work with Polars in various contexts. The library allows users to define complex data transformations using JSON syntax, which can then be translated into native Polars operations.

Example:

import polars as pl
from jsonpolars.api import parse_dfop

df = pl.DataFrame(
    [
        {"id": 1, "firstname": "Alice", "lastname": "Smith"},
        {"id": 2, "firstname": "Bob", "lastname": "Johnson"},
        {"id": 3, "firstname": "Cathy", "lastname": "Williams"},
    ]
)
dfop_data = {
    "type": "with_columns",
    "exprs": [
        {
            "type": "alias",
            "name": "fullname",
            "expr": {
                "type": "plus",
                "left": {"type": "column", "name": "firstname"},
                "right": {
                    "type": "plus",
                    "left": {
                        "type": "lit",
                        "value": " ",
                    },
                    "right": {"type": "column", "name": "lastname"},
                },
            },
        }
    ],
}
op = parse_dfop(dfop_data)
df1 = op.to_polars(df)
print(df1)

Output:

shape: (3, 4)
┌─────┬───────────┬──────────┬────────────────┐
 id   firstname  lastname  fullname       
 ---  ---        ---       ---            
 i64  str        str       str            
╞═════╪═══════════╪══════════╪════════════════╡
 1    Alice      Smith     Alice Smith    
 2    Bob        Johnson   Bob Johnson    
 3    Cathy      Williams  Cathy Williams 
└─────┴───────────┴──────────┴────────────────┘

Install

jsonpolars is released on PyPI, so all you need is to:

$ pip install jsonpolars

To upgrade to latest version:

$ pip install --upgrade jsonpolars

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

jsonpolars-0.1.1.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

jsonpolars-0.1.1-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file jsonpolars-0.1.1.tar.gz.

File metadata

  • Download URL: jsonpolars-0.1.1.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for jsonpolars-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5029aad4d0c9d92e797d86b7339c3890d3a9cb1f7089a724399b053d70e9d660
MD5 61b7800e318ca71879c254bc2d8963df
BLAKE2b-256 a5e163c1b913b95bb035dbcd43d1f1afd0f8528254e749d47ee304053ad0d3f3

See more details on using hashes here.

File details

Details for the file jsonpolars-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: jsonpolars-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for jsonpolars-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11e1c7a189983c6355c487a61365dd3b41b10f8b1532b85dbddcd340518d3c8d
MD5 ab3e388927740bd85affd23526cb8868
BLAKE2b-256 7aa13b868f9586cf7b843370277166e2e44a129b37760310fbc135b26daefec9

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