pandas-sans-lambdas 0.1.1

Creator: railscoder56

Last updated:

Add to Cart

Description:

pandassanslambdas 0.1.1

Pandas Sans Lambdas

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(sans_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!

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.