Topsis-Lakshita-102303505
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) - A Python package for multi-criteria decision analysis.
What is TOPSIS?
TOPSIS is a multi-criteria decision analysis method that identifies the alternative closest to the ideal solution and farthest from the negative-ideal solution. The ideal solution maximizes benefit criteria and minimizes cost criteria.
Installation
pip install Topsis-Lakshita-102303505
Usage
Command Line
topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>
Examples
# Example 1: Equal weights, all positive impacts
topsis data.csv "1,1,1,1,1" "+,+,+,+,+" output.csv
# Example 2: Different weights, mixed impacts
topsis data.csv "2,1,3,1,2" "+,+,-,+,+" results.csv
# Example 3: Using Excel file
topsis data.xlsx "1,1,1,2" "+,+,-,+" output.csv
Python API
from Topsis_Lakshita_102303505 import topsis_analysis
result_df = topsis_analysis(
input_file='data.csv',
weights='1,1,1,2',
impacts='+,+,-,+',
output_file='output.csv'
)
print(result_df)
Input File Format
The input file (CSV or Excel) must have:
- At least 3 columns: 1 name column + 2 or more criteria columns
- First column: Alternative names (text)
- Remaining columns: Numeric criteria values only
Example:
| Model | Price | Storage | Camera | Looks |
|---|---|---|---|---|
| M1 | 250 | 16 | 12 | 5 |
| M2 | 200 | 16 | 8 | 3 |
| M3 | 300 | 32 | 16 | 4 |
Parameters
-
Weights: Comma-separated numeric values (e.g.,
"1,1,1,2")- Must match the number of criteria columns
-
Impacts: Comma-separated
+or-signs (e.g.,"+,+,-,+")+for beneficial criteria (higher is better)-for cost criteria (lower is better)- Must match the number of criteria columns
Output
The output CSV file contains all original columns plus:
- Topsis Score: Performance score (0-1 range, higher is better)
- Rank: Integer ranking (1 = best alternative)
Example Output:
| Model | Price | Storage | Camera | Looks | Topsis Score | Rank |
|---|---|---|---|---|---|---|
| M3 | 300 | 32 | 16 | 4 | 0.691 | 1 |
| M1 | 250 | 16 | 12 | 5 | 0.534 | 2 |
| M2 | 200 | 16 | 8 | 3 | 0.308 | 3 |
Error Handling
The package validates:
- ✅ File existence
- ✅ Minimum 3 columns
- ✅ Numeric values in criteria columns
- ✅ Matching counts of weights, impacts, and criteria
- ✅ Valid impact signs (+ or -)
- ✅ Proper comma separation
Algorithm Steps
- Normalize the decision matrix using vector normalization
- Apply weights to normalized values
- Identify ideal solutions (best and worst)
- Calculate Euclidean distances from ideal solutions
- Compute performance scores
- Rank alternatives based on scores
Dependencies
- pandas >= 1.0.0
- numpy >= 1.18.0
- openpyxl >= 3.0.0 (for Excel support)
License
MIT License - See LICENSE file for details
Author
Lakshita Gupta
Email: lakshitagupta0518@gmail.com
Roll Number: 102303505
Links
- PyPI: https://pypi.org/project/Topsis-Lakshita-102303505/
- GitHub: https://github.com/Lakshita018/topsis
Version
1.0.0 (2026-01-20)
- Initial release
- TOPSIS algorithm implementation
- CSV and Excel file support
- Command-line interface
- Python API
- Comprehensive error handling
For detailed documentation, examples, and troubleshooting, visit the GitHub repository.
Metadata
Release files for Topsis-Lakshita-102303505 1.0.0
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 |
|---|---|---|---|---|
| topsis_lakshita_102303505-1.0.0.tar.gz | 6.1 kB | Without provenance | Details for topsis_lakshita_102303505-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| topsis_lakshita_102303505-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for topsis_lakshita_102303505-1.0.0-py3-none-any.whl |
Total release size: 13.1 kB
Release files / topsis_lakshita_102303505-1.0.0.tar.gz
| Download URL | topsis_lakshita_102303505-1.0.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69bdb5e6877e0e2961b53b9d8fe08d92243118ea3747fd805f87637ba08761b2
|
|
BLAKE2b-256 checksum How to use checksums |
ac368c122db12f1ef7ce50860ebfdf2a67d7c2a9872a76bd6960db6e70c0562f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / topsis_lakshita_102303505-1.0.0-py3-none-any.whl
| Download URL | topsis_lakshita_102303505-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3091bc3117532a062b9891a50ec1601c70965e80369095b7a3498400b68b30b5
|
|
BLAKE2b-256 checksum How to use checksums |
37b4bdb28c38ff079cad8039c8a4d5ad9b2107908bc39f71adc2f57567f0d8a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for Topsis-Lakshita-102303505 1.0.0
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.