Skip to main content

Who owes whom how much money

Project description

wowhmm

Who owes whom how much money?

wowhmm

Installation

pip install wowhmm

Usage

You first provide a list of who spent how much on whom. In the example below, Alice spent $349.95 on a BnB for everyone. To figure out the net amount owed to and from each person, call tabulate to return a pandas.DataFrame.

>>> from wowhmm import Ledger
>>>
>>> ledger = Ledger(
...     [
...         ("Alice", 349.95, ["Alice", "Bob", "Carol", "Dan"]),  # BnB
...         ("Bob", 68.42, ["Alice", "Dan"]),  # Alcohol
...         ("Bob", 42.02, ["Alice", "Bob", "Carol", "Dan"]),  # Groceries
...         ("Dan", 72.48, ["Alice", "Bob", "Carol", "Dan"]),  # Transportation
...         ("Carol", 28.98, ["Carol", "Dan"]),  # Movies
...     ]
... )
>>>
>>> ledger.tabulate()
       Alice    Bob  Carol    Dan
Alice   0.00 -42.77 -87.49 -69.37
Bob    42.77   0.00 -10.51 -26.60
Carol  87.49  10.51   0.00   3.63
Dan    69.37  26.60  -3.63   0.00

tabulate rounds each value to the penny. With row headers being who and column headers being whom, the data is the amount who owes whom. A value of 0 means no money is owed. A negative value means that who is actually owed whom by that absolute value. In the example above, Bob owes Alice $42.77.

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

wowhmm-0.1.5.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

wowhmm-0.1.5-py3-none-any.whl (2.7 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