TOPSIS Score calculation for MDM
Project description
Package Description:
Python package for TOPSIS (The Technique for Order of Preference by Similarity to Ideal Solution) Algorithm.
Steps to install and use the package:
STEP 1 : Download Python package from PyPi using pip install , Package name - 'Topsis-Dhairya-101916016'
STEP 2 :
For CMD -
python -m Topsis-Dhairya-101916016.main inputdata.csv 0.25,0.25,0.25,0.25 -,+,+,+ outputdata.csv
For Jupyter/Colab/Python IDE -
topsis = __import__("Topsis-Dhairya-101916016")
topsis.topsis("inputdata.csv","0.25,0.25,0.25,0.25","-,+,+,+","outputdata.csv")
After running Step 2 , output file (with mentioned name) will be created in same working directory which will create the csv with original dataframe , TOPSIS score and Rank.
Main Function in Package:
topsis(_inputcsv,_weights,_impacts,_resultfilename)
Takes 4 arguments -
_inputcsv = The name of input csv which have data
_weights = Weights associated with each column in str format. eg - "1,2,1,1"
_impacts = Impacts associated with each column in str format. eg - "+,+,+,+"
_resultfilename = The name of output csv which have TOPSIS score and rank
This function will perform TOPSIS calculation and store the resultant csv in the working directory with provided name.
##Below Functions are used by topsis function for calculation of Topsis Score and Rank
checkfornumerical(_df)
Takes 1 argument -
_df = DataFrame without the first column (which is usually str)
This function will return True if all the values in _df is numerical
normalize(_evaldf)
Takes 1 argument -
_evaldf = DataFrame without the first column (which is usually str)
This function will return the normalised DataFrame. Normalisation is done on basis of each value divided by root of sum of squares of column.
addingweights(_evaldf,_weights)
Takes 2 arguments -
_evaldf = DataFrame without the first column (which is usually str)
_weights = Weights associated with each column in str format. eg - "1,2,1,1"
This function will return the weighted DataFrame. Adding weights is done by multiplying weight to value for each column.
idealbestworst(_evaldf,_impacts)
Takes 2 arguments -
_evaldf = DataFrame without the first column (which is usually str)
_impacts = Impacts associated with each column in str format. eg - "-,+,+,+"
This function will return the ideal best and ideal worst in DataFrame. 2 new rows will be added in returned Dataframe , first one being Ideal Best and Second one being Ideal Worst.
euclideandistance(_evaldf)
Takes 1 argument -
_evaldf = DataFrame without the first column (which is usually str) and 2 more rows including ideal best and worst respectively.
This function will return the Topsis score as new column in DataFrame provided. 2 new rows will be added in returned Dataframe , It uses Euclidean Distance for calculation of Performance/Topsis Score.
givingranks(_evaldf)
Takes 1 argument -
_evaldf = DataFrame without the first column (which is usually str) and 1 more column which is performance score.
This function will return the Topsis score and Ranking as new column in DataFrame provided. It uses Hashmap for calculation and gives rank 1 to the highest Topsis Score.
Requirements for Package:
Pandas
Numpy
Input file handling:
Input File must have atleast 3 columns and should have Numerical values only except the first column.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Topsis-Dhairya-101916016-1.5.0.tar.gz.
File metadata
- Download URL: Topsis-Dhairya-101916016-1.5.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a93922850416b29ee4431b9f6af74c05f891d11dbf4c2afc6414f8c50956e84b
|
|
| MD5 |
28f4bf2a551af5a59fa6d6783ad1fff9
|
|
| BLAKE2b-256 |
fc055a8839ac8afd09e8c1163a0b35bb56f98bc90a1fd34bf544ac7c936dac9a
|
File details
Details for the file Topsis_Dhairya_101916016-1.5.0-py3-none-any.whl.
File metadata
- Download URL: Topsis_Dhairya_101916016-1.5.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ac7c6fd25225718bd64c279ee88b13b22a807139a3dfc8f2c034a9763e524ec
|
|
| MD5 |
7bb0dc7ad01b4c30ba006095c4287def
|
|
| BLAKE2b-256 |
847fa047c628d03dfbab2f979a915404aae27c100c4fc2e2d33300a8f9a0509d
|