Bussines Manager
Bussines Manager is a Python library designed to analyze sales data from small businesses, such as bakeries, cafés, and retail stores.
It provides tools for analyzing products, revenue, customer purchasing habits, and peak sales days and hours.
1. Requirements
- Python 3.10 or higher.
- pandas.
- numpy.
These dependencies are specified in the pyproject.toml file.
2. Installation
Once the library has been published on PyPI, it can be installed using:
pip install bussines-manager
The library can be imported into Python using:
import bussines_manager as bm
3. CSV File Format
The library works with CSV files containing the following columns:
| Column | Description |
|---|---|
| Fecha | Sale date (YYYY-MM-DD) |
| ID_Ticket | Unique numeric ticket identifier |
| Producto | Name of the product |
| Categoria | Product category |
| Precio | Unit price of the product |
| Cantidad | Number of units sold |
| Hora | Time of sale (HH:MM) |
The Hora column is optional for most analyses but required for the peak hours analysis.
Example CSV
Fecha,ID_Ticket,Producto,Categoria,Precio,Cantidad,Hora
2026-11-01,1,Pan,Panaderia,1.50,2,09:30
2026-11-01,1,Cafe,Bebidas,1.80,1,09:30
2026-11-01,2,Croissant,Bolleria,2.00,3,10:15
2026-11-01,2,Cafe,Bebidas,1.80,2,10:15
2026-11-02,3,Pan,Panaderia,1.50,4,11:00
4. Available Functions
4.1. validar_ventas()
Validates the CSV file by checking its structure, required columns, and data types.
If the file contains invalid data, the function raises an error and stops the analysis.
4.2. productos_estrella()
Identifies the best-selling products based on total revenue and units sold.
Returns two tables ranked from highest to lowest.
4.3. productos_menos_vendidos()
Identifies the least-selling products based on total revenue and units sold.
Returns two tables ranked from lowest to highest.
4.4. analisis_cesta()
Analyzes which products are frequently purchased together in the same transaction.
Calculates the number of occurrences and the percentage of transactions containing each product pair.
Returns up to five most frequent and five least frequent observed combinations.
4.5. dias_pico()
Identifies the days of the week with the highest average revenue.
4.6. ticket_medio()
Calculates the average amount spent per transaction.
4.7. cantidad_media_producto()
Calculates the average quantity purchased of a specific product per transaction containing that product.
4.8. horas_pico()
Identifies the hours of the day with the highest sales revenue and number of units sold.
4.9. ventas_por_categoria()
Groups products by category and calculates total revenue and units sold for each category.
4.10. tamano_medio_cesta()
Calculates the average number of units and distinct products purchased per transaction.
5. Usage Examples
First, import the library:
import bussines_manager as bm
Best-Selling Products
revenue, units = bm.productos_estrella("ventas.csv")
print(revenue)
print(units)
Least-Selling Products
revenue, units = bm.productos_menos_vendidos("ventas.csv")
print(revenue)
print(units)
Market Basket Analysis
basket = bm.analisis_cesta("ventas.csv")
print(basket)
Peak Sales Days
days = bm.dias_pico("ventas.csv")
print(days)
Average Transaction Value
average = bm.ticket_medio("ventas.csv")
print("Average transaction value:", average)
Average Product Quantity
average = bm.cantidad_media_producto("ventas.csv", "Pan")
print("Average quantity:", average)
Peak Sales Hours
hours = bm.horas_pico("ventas.csv")
print(hours)
Sales by Category
categories = bm.ventas_por_categoria("ventas.csv")
print(categories)
Average Basket Size
units, products = bm.tamano_medio_cesta("ventas.csv")
print("Average units:", units)
print("Average distinct products:", products)
6. Data Validation
All analysis functions validate the CSV file before processing the data.
If the file contains missing columns, incorrect data types, invalid dates, or negative values where positive values are required, the library raises an error indicating the problem.
When the data is valid, the analysis continues without displaying unnecessary validation messages.
7. Authors
Developed by Miguel and Xabier.
8. License
This project is distributed under the MIT License. See the LICENSE file for more information.
Metadata
Release files for bussines-manager 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bussines_manager-0.1.1.tar.gz | 6.0 kB | Without provenance | Details for bussines_manager-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bussines_manager-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for bussines_manager-0.1.1-py3-none-any.whl |
Total release size: 12.2 kB
Release files / bussines_manager-0.1.1.tar.gz
| Download URL | bussines_manager-0.1.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6405d96e6f6a9bd40575ffbf334cf99375374a45fb68098f19ad85068c091da9
|
|
BLAKE2b-256 checksum How to use checksums |
1e60d268c2b35f5c6f38940cd47eb5d29287130f97ef7ba444a2f5d9010a93ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.1
|
Release files / bussines_manager-0.1.1-py3-none-any.whl
| Download URL | bussines_manager-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27ebff0930e60e13ae6779f5e9dde2e15729945a5febe1335064401edde7dd13
|
|
BLAKE2b-256 checksum How to use checksums |
e4ffebcaff74d50273a2a31174a790c514e251cb2a1f9cd5870c4bfa23072250
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.1
|
Security for bussines-manager 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.