A python package implementing topsis
Project description
Submitted By: Aparna Sood
What is TOPSIS?
Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) originated in the 1980s as a multi-criteria decision making method. TOPSIS chooses the alternative of shortest Euclidean distance from the ideal solution, and greatest distance from the negative-ideal solution.
It is a package for Multiple-criteria decision-making using TOPSIS. Requires input file,weights and impacts. Returns a data frame which has score and rank of every label. This package helps improve decision-making.
Installation
pip install Topsis-Aparna-102016091
Usage
import Topsis_Aparna_102016091 as ap
ap.topsisscore(inputfilename.csv , weights , impacts , outputfilename.csv)
- weights and impacts provided as parameters should be separated by comma(,) and equal to number of columns.
- weights should only contain numeric values
- the categorical column should either be dropped or enginnered into a numerical column
Take care of these and you are ready to go.
Result
The output (outputfilename.csv) is saved as csv file, with extra two columns of topsis score and rank. Rank 1 signifies best decision.
Contribution
Pull requests are welcome!!
Example
inputfilename.csv
| Fund Name | P1 | P2 | P3 | P4 | P5 |
|---|---|---|---|---|---|
| M1 | 0.8 | 0.64 | 6.9 | 44.5 | 13.21 |
| M2 | 0.81 | 0.66 | 7 | 33.1 | 10.39 |
| M3 | 0.89 | 0.79 | 4.1 | 49.1 | 13.72 |
| M4 | 0.8 | 0.64 | 4.8 | 45.1 | 12.84 |
| M5 | 0.79 | 0.62 | 7 | 65.1 | 18.38 |
| M6 | 0.8 | 0.64 | 4.1 | 51.2 | 14.19 |
| M7 | 0.61 | 0.37 | 4.2 | 48 | 13.3 |
| M8 | 0.71 | 0.5 | 4.1 | 43.1 | 12.1 |
weights = "1,1,1,1,1"
impacts = "+,-,+,-,+"
outputfilename.csv
| FIELD1 | Fund Name | P1 | P2 | P3 | P4 | P5 | topsis score | rank |
|---|---|---|---|---|---|---|---|---|
| 0 | M1 | 0.8 | 0.64 | 6.9 | 44.5 | 13.21 | 0.5513405258358909 | 1.0 |
| 1 | M2 | 0.81 | 0.66 | 7.0 | 33.1 | 10.39 | 0.5474324527004779 | 2.0 |
| 2 | M3 | 0.89 | 0.79 | 4.1 | 49.1 | 13.72 | 0.356585782293044 | 8.0 |
| 3 | M4 | 0.8 | 0.64 | 4.8 | 45.1 | 12.84 | 0.4305717292651279 | 6.0 |
| 4 | M5 | 0.79 | 0.62 | 7.0 | 65.1 | 18.38 | 0.5240978466600755 | 3.0 |
| 5 | M6 | 0.8 | 0.64 | 4.1 | 51.2 | 14.19 | 0.38297613208032333 | 7.0 |
| 6 | M7 | 0.61 | 0.37 | 4.2 | 48.0 | 13.3 | 0.5010998980377374 | 4.0 |
| 7 | M8 | 0.71 | 0.5 | 4.1 | 43.1 | 12.1 | 0.45991281671067175 | 5.0 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file Topsis_Aparna_102016091-0.3.tar.gz.
File metadata
- Download URL: Topsis_Aparna_102016091-0.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1a01a6208e83d9d042ca071ca6d463375c25668b8aa2fdb5f7f79edd9d2c65f
|
|
| MD5 |
7eb7f1f96bde2725bbd0c4116e041715
|
|
| BLAKE2b-256 |
8c3da3b66dd94b46c4d9bf80430aff2d9b03a58f6f1110222e76fe19401f31c7
|