Skip to main content

The fastest way to make sense of a transaction log.

Project description

Transactions

Lifestream is a Python library to make sense out of your transaction logs. Import a log of your transactional data and let's explore!

Installation

Use the package manager pip to install foobar.

pip install lifestream

Transactional Data

At a minimum, the transactional data you import should have the following:

  • OrderID assoiated with transaction
  • Unique user id associated with transaction
  • Date of transaction
  • Monetary value of transaction
order_id user_id date monetary_value
768 13 09/13/2020 $15.12
769 13249 09/13/2020 $240.00
770 11424 09/13/2020 $194.34

Is your transactional data in another kind of format? See the create_transaction_log function below.

Usage

Want to plot sales by month?

import lifestream

lifestream.sales_chart(transaction_log, date_col, monetary_val, user_id)
  • transaction_log is a dataframe of your transactional data.
  • date_col represents the column of the transaction_log dataframe which contains the datetime of the transaction.
  • monetary_val represents the column of the transaction_log dataframe which contains the monetary value of the transaction.
  • user_id represents the column of the transaction_log dataframe which contains the unique user id associated with the transaction.

Want to dig into basic cohort analyses? Plot how many users from a cohort are still spending in subsequent months.

lifestream.cohort_retention_chart(df, date_col, order_id, user_id, monetary_val, cohort1, cohort2, cohort3)
  • df is a dataframe of your transactional data.
  • date_col represents the column of the dataframe which contains the datetime of the transaction.
  • user_id represents the column of the dataframe which contains the unique user id associated with the transaction.
  • monetary_val represents the column of the dataframe which contains the monetary value of the transaction.
  • cohort1, cohort2, cohort3 are the three cohorts you are interested in, expressed as 'YYYY-MM' string.

Need to create a transaction log that meets the library's requirements? If your data is as raw as the individually purchased items, try this method.

lifestream.create_transaction_log(df, invoicenum, date_col, quantity, unitprice, customerid)
  • df is a dataframe of your data.
  • date_col represents the column of the dataframe which contains the datetime of the transaction.
  • user_id represents the column of the dataframe which contains the unique user id associated with the transaction.
  • quantity represents the column of the dataframe which contains the quantity of an item purchased in the transaction.
  • unitprice represents the column of the dataframe which contains the price of an item purchased in the transaction
  • customerid is the unique id associated with the customer making the purchase.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

lifestream-0.0.1.tar.gz (107.7 kB view details)

Uploaded Source

Built Distribution

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

lifestream-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file lifestream-0.0.1.tar.gz.

File metadata

  • Download URL: lifestream-0.0.1.tar.gz
  • Upload date:
  • Size: 107.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for lifestream-0.0.1.tar.gz
Algorithm Hash digest
SHA256 de33ccd9e82bab2877a0bd8b3925d38d555b46e53f54cc5dd2d2bbb24d7132f1
MD5 2f622f1cdf91a8aca27f75e5336fea5c
BLAKE2b-256 0ee83833d1ff29be09caf2d075e77bdadb65ed9014044187179a6e0d6bb614a5

See more details on using hashes here.

File details

Details for the file lifestream-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lifestream-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for lifestream-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25c6ae5fcc23fac602f94cd926a92cc4384fc9f4133889d15f684fcd27beadd0
MD5 d71b7cd290262f96c5dc3f5170d5ddb5
BLAKE2b-256 5866ec8d26efe5c7c421d47e5f82cc961cc2183ec187e77c513401944c9b7eb1

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