Observed since 20 Oct, 15:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A Python implementation of the TOPSIS decision-making method
This README provides step-by-step instructions on how to use the TOPSIS package in a Jupyter Notebook.
Before running the TOPSIS function, ensure the package is installed. You can either install it from PyPI or locally:
!pip install Topsis_102216005
If the package is not uploaded to PyPI, navigate to the folder containing the setup.py file and run:
!pip install .
Use the following code to import the topsis function:
from Topsis_102216005 import topsis
Ensure you have a CSV file (e.g., data.csv) with the following structure:
Example CSV (data.csv):
| Object | Criterion 1 | Criterion 2 | Criterion 3 | Criterion 4 |
|---|---|---|---|---|
| M1 | 250 | 16 | 12 | 5 |
| M2 | 200 | 12 | 15 | 8 |
| M3 | 300 | 18 | 10 | 6 |
| M4 | 275 | 20 | 14 | 7 |
Specify the following parameters:
input_file: Path to the CSV file (e.g., data.csv).weights: Comma-separated weights for the criteria (e.g., 1,1,1,2).impacts: Comma-separated impacts (+ for beneficial, - for non-beneficial, e.g., +,+,-,+).output_file: Name of the output file to save the results (e.g., result.csv).Use the following code to run the TOPSIS analysis:
# Import the necessary function
from Topsis_102216005 import topsis
# Define inputs
input_file = "data.csv"
weights = "1,1,1,2"
impacts = "+,+,-,+"
output_file = "result.csv"
# Run TOPSIS
topsis(input_file, weights, impacts, output_file)
# Display the output file (optional)
import pandas as pd
result = pd.read_csv(output_file)
print(result)
The output CSV file (result.csv) will include all original columns, along with two additional columns:
Example Output (result.csv):
| Object | Criterion 1 | Criterion 2 | Criterion 3 | Criterion 4 | Topsis Score | Rank |
|---|---|---|---|---|---|---|
| M1 | 250 | 16 | 12 | 5 | 0.85 | 1 |
| M2 | 200 | 12 | 15 | 8 | 0.65 | 3 |
| M3 | 300 | 18 | 10 | 6 | 0.70 | 2 |
| M4 | 275 | 20 | 14 | 7 | 0.60 | 4 |
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.1 | 19 Jan 2025 | 2 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 15:09 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:7e0c0823753d50229fa1ad6f16bde2c267b9cd93baf34c5b168bed6ca594fbd1