Skip to main content

Tools to simplify pandas-based data processing

Project description

Pandas Sans Lambdas

Tests

Pandas method chaining using assign or loc usually means using lambdas. These get repetitive and reduce readability. Pandas Sans Lambdas is a solution to this. Here's an example:

import pandas as pd
from pandas_sans_lambdas import col

df = pd.DataFrame({"a": [1,2,3], "b": [4,5,6]})

# The old way
df = df.assign(with_lambdas = lambda DF: DF["a"] ** 2 / DF["b"])

# The new way
df = df.assign(with_lambdas = col("a") ** 2 / col("b"))

print(df)

Hopefully you agree that this is more readable!

Current project status

This package is under development. Specifically, unit test coverage is currently incomplete. Get in touch if you want to contribute to test coverage, or if you find any bugs!

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

pandas_sans_lambdas-0.1.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

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

pandas_sans_lambdas-0.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file pandas_sans_lambdas-0.1.0.tar.gz.

File metadata

  • Download URL: pandas_sans_lambdas-0.1.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pandas_sans_lambdas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d5eb87e83c703a3e3a80a59bc6c646fdc457e7d548bb9fc3cf1b3aee5b60c72
MD5 d538be80d6f3d9cee9111090f99886b7
BLAKE2b-256 0a420f33b11718166fabf06826f932598375c1a0ecdc82dd190b1b1776cd7d84

See more details on using hashes here.

File details

Details for the file pandas_sans_lambdas-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pandas_sans_lambdas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06f4c563fc254721cfdcde34d8013938ab534bec958b732b7f777a8eb653ef7c
MD5 b899c90798a0f9375357584a753b01f5
BLAKE2b-256 5744012ae803b4c8dcaf99329b2c1363c2dc0b23ca0d1d904737d6bfd093a0ae

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