Skip to main content

No project description provided

Project description

TOPSIS Analysis Package

A Python library for performing TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) analysis on numerical datasets. This tool supports both command-line functionality and a programmatically importable module for analyzing datasets with numerical entries (e.g., int32, int64, float32, float64). Overview

TOPSIS is a decision-making technique used to rank alternatives based on their proximity to an ideal solution, considering multiple criteria. This package handles data normalization, assigns weights to criteria, and factors in whether criteria should be maximized or minimized. Installation

pip install topsis-102217132

Usage As a Python Module

from topsis_analysis import run

Perform TOPSIS analysis

result_df = run( input_df, # Pandas DataFrame with numerical columns weights, # List of numerical weights for each criterion impacts, # List of '+' (maximize) or '-' (minimize) for each criterion )

Command-Line Tool

python -m topsis_analysis <input_csv_path> <output_csv_path>

Parameters General Parameters (Module & CLI):

Input Data:
    Must consist solely of numerical values (int32, int64, float32, float64)
    The first column will serve as the identifier (index)
    Datasets with missing values are not supported.

Weights:
    Must sum up to 1
    The number of weights must equal the number of numerical columns (excluding the identifier/index column)
    For the module: Provide as a Python list of floats
    For CLI: Provide as a comma-separated string (e.g., "0.3,0.4,0.3")

Impacts:
    Use '+' for criteria to maximize and '-' for criteria to minimize
    The number of impacts should match the number of numerical columns (excluding the identifier/index column)
    For the module: Provide as a Python list of strings
    For CLI: Provide as a comma-separated string (e.g., "-,+,+,-")

CLI-Only Parameters:

output_csv_path: File path where the output CSV will be saved.

Example Usage As a Python Module

import pandas as pd from topsis_analysis import run

Read the input dataset

data = pd.read_csv('input_data.csv')

Define weights and impacts

weights = [0.3, 0.4, 0.3] impacts = ['+', '+', '-']

Run TOPSIS

result = run(data, weights, impacts)

Save the results

result.to_csv('result.csv', index=False)

Using the CLI

python -m topsis-102217132 input_data.csv 0.3,0.4,0.3 +,+,- result.csv

Input CSV Format Example

Model,Price,Storage,Battery,Performance A,799,256,12,85 B,999,512,10,92 C,699,128,15,78

Output CSV Example

Model,Price,Storage,Battery,Performance,TOPSIS Score,Rank A,799,256,12,85,0.534,2 B,999,512,10,92,0.687,1 C,699,128,15,78,0.423,3

Error Handling

The package offers robust error validation to ensure the following:

Matching numbers of weights, impacts, and criteria columns
Presence of numerical data types
No missing values in the input data
Valid paths for reading/writing files (CLI)
Proper '+' or '-' symbols in the impact list

Dependencies

Python 3.7 or higher
pandas
numpy

Contribution

Contributions are highly appreciated! Feel free to open issues or submit pull requests for improvements. License

This package is distributed under the MIT License. Refer to the LICENSE file for full details. 2/2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsis-Angad-Singh-102217132-0.0.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topsis_Angad_Singh_102217132-0.0.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file topsis-Angad-Singh-102217132-0.0.3.tar.gz.

File metadata

File hashes

Hashes for topsis-Angad-Singh-102217132-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a16ada9694ca58841516b9913e626adc023ef47e289d31b5caa6bcdd6d5cf974
MD5 2199c0287e018ba41e3a48d796529739
BLAKE2b-256 629e8534315c51a64dc9e175209332707b7611f9f233d608880a0104a8c3ae21

See more details on using hashes here.

File details

Details for the file topsis_Angad_Singh_102217132-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_Angad_Singh_102217132-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b95baf0f5f1373775b1f7f1ca967183866058ed7f4176afe016eb6109997c9d8
MD5 d1162431df2264cd11391e2b780b5844
BLAKE2b-256 b830801c77f41a8f58e9c50a7e6a525fe70d302a535e60183f09f611d7b25b9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page