Skip to main content

No project description provided

Project description

Panorma

A lightweight Python package (just over 50 lines of code) that enables you to create typed models for Pandas DataFrames using classes.

You can easily define structured models, enforce column typing, enjoy autocompletion, and catch invalid column errors early in your DataFrame operations.

Simplify your data modeling and enhance the reliability of your DataFrame workflows.

Installation:

  pip install panorma

Example:

  • Create some models:
from panorma.fields import StringDtype, Int16Dtype, Float32Dtype, Timestamp, CategoricalDtype
from panorma.frames import DataFrame

class Users(DataFrame):
    name: StringDtype
    age: Int16Dtype
    percentage: Float32Dtype
    birth_date: Timestamp


class Cars(DataFrame):
    car: StringDtype
    mpg: Float32Dtype
    cylinders: Int16Dtype
    displacement: Float32Dtype
    horsepower: Float32Dtype
    weight: Float32Dtype
    acceleration: Float32Dtype
    model: Int16Dtype
    origin: CategoricalDtype
  • Instantiate your models as you instantiate a simple pandas dataframe
import pandas as pd

users = Users({
    "name": ['john', 'kevin'],
    "age": [99, 15],
    "percentage": [0.8, 7.3],
    "birth_date": [pd.Timestamp('20180310'), pd.Timestamp('20230910')],
})
cars = Cars(pd.read_csv('CAR_DATASET.csv'))
  • You will get autocompletion for models columns and pandas at the same time image

  • If the columns of your data are not matching your model, you will get a NotMatchingFields exception: image

  • If a column cannot be cast to the type declared in the model, you will get a ParseError exception: image

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

panorma-0.1.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

panorma-0.1.0-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

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