A Python package to implement TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)
Project description
Topsis-Krish-102203848
Topsis-Krish-102203848 is a Python package for implementing the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS), a multi-criteria decision-making (MCDM) method. This package simplifies the process of ranking and selecting alternatives based on multiple criteria with varying weights and impacts.
Installation
Install the package from PyPI using pip:
pip install Topsis_Krish_102203848
Usage
Command-Line Interface (CLI)
Prepare a CSV file with the following format:
The first column contains the names of the alternatives (e.g., "M1", "M2").
The subsequent columns contain numeric values for each criterion.
Ensure the file has a header row.
Example:
FundName P1 P2 P3 P4 P5
M1 0.67 0.45 6.5 42.6 12.56
M2 0.6 0.36 3.6 53.3 14.47
E.g. Program-
import os
from topsis.topsis import main
# def run_topsis():
# # Define input file
# input_file = "input.csv"
# # Define weights and impacts
# weights = "1,1,1,1,1" # Example: Equal weights for all criteria
# impacts = "+,+,-,+,-" # Example: Benefits (+) and costs (-) criteria
# # Define output file
# output_file = "output.csv"
# # Generate the input CSV file
# data = """Fund Name,P1,P2,P3,P4,P5
# M1,0.67,0.45,6.5,42.6,12.56
# M2,0.6,0.36,3.6,53.3,14.47
# M3,0.82,0.67,3.8,63.1,17.1
# M4,0.6,0.36,3.5,69.2,18.42
# M5,0.76,0.58,4.8,43,12.29
# M6,0.69,0.48,6.6,48.7,14.12
# M7,0.79,0.62,4.8,59.2,16.35
# M8,0.84,0.71,6.5,34.5,10.64"""
# with open(input_file, "w") as file:
# file.write(data)
# print(f"Input file '{input_file}' has been created.")
# # Run TOPSIS
# try:
# main(input_file, weights, impacts, output_file)
# print(f"Output file '{output_file}' has been generated.")
# except Exception as e:
# print(f"Error during TOPSIS execution: {e}")
#
# if os.path.exists(output_file):
# with open(output_file, "r") as file:
# print("\nGenerated Output File Content:")
# print(file.read())
# if __name__ == "__main__":
# run_topsis()
License
This package is licensed under the MIT License.
Contributing
Contributions are welcome! Feel free to fork the repository and submit pull requests.
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_krish_102203848-1.0.2.tar.gz.
File metadata
- Download URL: topsis_krish_102203848-1.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be2f8b04dcfa4a2404fe4322b4b971521670058063563744bc5d625c5ae80f55
|
|
| MD5 |
726b944cf61ccbcf8105a82e37a65825
|
|
| BLAKE2b-256 |
fd24c3337e7979ea7a4d015d3d378c8e337fbde38aacbb0174ba4ae7f4712748
|
File details
Details for the file Topsis_Krish_102203848-1.0.2-py3-none-any.whl.
File metadata
- Download URL: Topsis_Krish_102203848-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8445771c03c70df4899f2241ef037ff0a519f8e9b3098121b179d7b3789c34cf
|
|
| MD5 |
d7e92322b2c39b40296d9b985d674db4
|
|
| BLAKE2b-256 |
2f02eb3d3f5626c20b9c4efc94601303c4942746148a4545d7e34a3f8cf0af19
|