TOPSIS implementation in python for multi-criteria decision making
Class project for DATA ANALYSIS AND VISUALISATION 2020 - UCS633 Thapar University, Patiala
Navkiran Singh
COE17
Roll number: 101703365
Update: Added windows command line support
Output is a dataframe with 3 columns
- Alternatives serial number
- Corresponding performance Score or closeness to ideal solution
- Rank
Installation
pip install topsis_navkiran
Note the name has an underscore not a hyphen. If installation gives error or package is not found after installing, install as sudo.
Recommended - test it out in a virtual environment.
Upgrade
pip install topsis_navkiran --upgrade
To use via command line
topsis_navkiran_cli data.csv 25,25,25,25 -+++
First argument after run.py is filename with .csv extension. The .csv file is assumed to have a structure similar to one provided in topsis_navkiran/data.csv
That is, the .csv file should have a header with column names and first column should only list alternatives and not attribute values.
To use in .py script
from topsis_navkiran import topsis
"""
decision_matrix is 2D numpy array, weights is a 1D array and impacts is a string of the form +-+--
where + indicates benefit and - indicates cost
"""
output_dataframe = topsis(decision_matrix,weights,impacts)
Debugging and Exception Handling
The program has several assert statements which raise errors with helpful description in the following cases:
- Wrong dimensions of decision matrix (not 2D), weights (not 1D)
- Length of weights and impacts don't match
- Weights or impacts don't match number of attributes
- For command line, number of arguments is less than 3 required
- File extension must be .csv
Based off on a similar package for TOPSIS in R
Metadata
Release files for topsis-navkiran 1.1.4
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_navkiran-1.1.4.tar.gz | 3.7 kB | Without provenance | Details for topsis_navkiran-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| topsis_navkiran-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for topsis_navkiran-1.1.4-py3-none-any.whl |
Total release size: 8.9 kB
Security for topsis-navkiran 1.1.4
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.