topsis-Mridul


Nametopsis-Mridul JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/mridulmahajan04/Topsis_Package/
SummaryA Python implementation of the TOPSIS decision-making method
upload_time2025-08-10 19:20:48
maintainerNone
docs_urlNone
authorMridul Mahajan
requires_python>=3.6
licenseMIT
keywords topsis decision-making multi-criteria ranking optimization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)

TOPSIS is a Python library for implementing the Technique for Order of Preference by Similarity to Ideal Solution, a multi-criteria decision-making method. This library allows users to rank alternatives based on given criteria, weights, and impacts.

Installation

You can install the library via pip:

pip install topsis-Mridul

Usage

Command-line Usage

The library can be used directly from the command line. Here's the general syntax:

python <program.py> <InputDataFile> <Weights> <Impacts> <ResultFileName>

Example

Create an input file, data.csv:

Name,C1,C2,C3,C4
A,250,16,12,5
B,200,32,8,3
C,300,24,10,4
D,275,20,11,4
E,225,28,9,2

Run the command:

python topsis.py data.csv "0.25,0.25,0.25,0.25" "+,+,-,+" result.csv

The output result.csv will contain:

Name,C1,C2,C3,C4,Topsis Score,Rank
A,250,16,12,5,0.64,2
B,200,32,8,3,0.43,4
C,300,24,10,4,0.78,1
D,275,20,11,4,0.56,3
E,225,28,9,2,0.36,5

Python Library Usage

Importing the Library

You can also use the library directly in Python:

from topsis import Topsis

# Input data
data = "data.csv"
weights = [0.25, 0.25, 0.25, 0.25]
impacts = ["+", "+", "-", "+"]
result_file = "result.csv"

# Perform TOPSIS
Topsis(data, weights, impacts, result_file)
print(f"Results saved in {result_file}")

Parameters

InputDataFile: A CSV file with the first column as the name of the alternatives and the rest as numeric criteria.

Weights: A comma-separated string of numeric weights (e.g., "0.25,0.25,0.25,0.25").

Impacts: A comma-separated string of impacts for each criterion, either + (positive impact) or - (negative impact).

ResultFileName: The name of the output CSV file where results will be saved.

Features

Validate input file format and values.

Handle missing or invalid values gracefully.

Normalize and weight criteria.

Calculate TOPSIS scores and rankings.

Limitations

All criteria must be numeric.

The number of weights and impacts must match the number of criteria.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Feel free to open issues or create pull requests to improve the library!



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mridulmahajan04/Topsis_Package/",
    "name": "topsis-Mridul",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "Mridul Mahajan <mridulmahajan16@gmail.com>",
    "keywords": "topsis, decision-making, multi-criteria, ranking, optimization",
    "author": "Mridul Mahajan",
    "author_email": "Mridul Mahajan <mridulmahajan16@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bb/dc/cae4b8284f0e8fd300f6ae82c09f2ed8438b90f38bc22923d434069d486f/topsis_mridul-1.0.0.tar.gz",
    "platform": null,
    "description": "TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)\r\n\r\nTOPSIS is a Python library for implementing the Technique for Order of Preference by Similarity to Ideal Solution, a multi-criteria decision-making method. This library allows users to rank alternatives based on given criteria, weights, and impacts.\r\n\r\nInstallation\r\n\r\nYou can install the library via pip:\r\n\r\npip install topsis-Mridul\r\n\r\nUsage\r\n\r\nCommand-line Usage\r\n\r\nThe library can be used directly from the command line. Here's the general syntax:\r\n\r\npython <program.py> <InputDataFile> <Weights> <Impacts> <ResultFileName>\r\n\r\nExample\r\n\r\nCreate an input file, data.csv:\r\n\r\nName,C1,C2,C3,C4\r\nA,250,16,12,5\r\nB,200,32,8,3\r\nC,300,24,10,4\r\nD,275,20,11,4\r\nE,225,28,9,2\r\n\r\nRun the command:\r\n\r\npython topsis.py data.csv \"0.25,0.25,0.25,0.25\" \"+,+,-,+\" result.csv\r\n\r\nThe output result.csv will contain:\r\n\r\nName,C1,C2,C3,C4,Topsis Score,Rank\r\nA,250,16,12,5,0.64,2\r\nB,200,32,8,3,0.43,4\r\nC,300,24,10,4,0.78,1\r\nD,275,20,11,4,0.56,3\r\nE,225,28,9,2,0.36,5\r\n\r\nPython Library Usage\r\n\r\nImporting the Library\r\n\r\nYou can also use the library directly in Python:\r\n\r\nfrom topsis import Topsis\r\n\r\n# Input data\r\ndata = \"data.csv\"\r\nweights = [0.25, 0.25, 0.25, 0.25]\r\nimpacts = [\"+\", \"+\", \"-\", \"+\"]\r\nresult_file = \"result.csv\"\r\n\r\n# Perform TOPSIS\r\nTopsis(data, weights, impacts, result_file)\r\nprint(f\"Results saved in {result_file}\")\r\n\r\nParameters\r\n\r\nInputDataFile: A CSV file with the first column as the name of the alternatives and the rest as numeric criteria.\r\n\r\nWeights: A comma-separated string of numeric weights (e.g., \"0.25,0.25,0.25,0.25\").\r\n\r\nImpacts: A comma-separated string of impacts for each criterion, either + (positive impact) or - (negative impact).\r\n\r\nResultFileName: The name of the output CSV file where results will be saved.\r\n\r\nFeatures\r\n\r\nValidate input file format and values.\r\n\r\nHandle missing or invalid values gracefully.\r\n\r\nNormalize and weight criteria.\r\n\r\nCalculate TOPSIS scores and rankings.\r\n\r\nLimitations\r\n\r\nAll criteria must be numeric.\r\n\r\nThe number of weights and impacts must match the number of criteria.\r\n\r\nLicense\r\n\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n\r\nContributing\r\n\r\nFeel free to open issues or create pull requests to improve the library!\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python implementation of the TOPSIS decision-making method",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/mridulmahajan04/Topsis_Package/issues",
        "Homepage": "https://github.com/mridulmahajan04/Topsis_Package/",
        "Repository": "https://github.com/mridulmahajan04/Topsis_Package/"
    },
    "split_keywords": [
        "topsis",
        " decision-making",
        " multi-criteria",
        " ranking",
        " optimization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0066b0d11f0f8e121c8d90060b903edef1f14d931841a5d85e9bcf4cffbf3fb2",
                "md5": "e1ef57771bad897261a27b7a079a3a35",
                "sha256": "3eb6017e730e725e3939ceb2e2c5f89b8ff43a18645d5c31fe2c1f58661fe464"
            },
            "downloads": -1,
            "filename": "topsis_mridul-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e1ef57771bad897261a27b7a079a3a35",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7159,
            "upload_time": "2025-08-10T19:20:46",
            "upload_time_iso_8601": "2025-08-10T19:20:46.404491Z",
            "url": "https://files.pythonhosted.org/packages/00/66/b0d11f0f8e121c8d90060b903edef1f14d931841a5d85e9bcf4cffbf3fb2/topsis_mridul-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bbdccae4b8284f0e8fd300f6ae82c09f2ed8438b90f38bc22923d434069d486f",
                "md5": "fb7a1636a67636a1305d05deea2340d6",
                "sha256": "e4c2dcccec3239198f50f160c62ba57eb3767739481006f9c3282d9f6a8bf65f"
            },
            "downloads": -1,
            "filename": "topsis_mridul-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fb7a1636a67636a1305d05deea2340d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7713,
            "upload_time": "2025-08-10T19:20:48",
            "upload_time_iso_8601": "2025-08-10T19:20:48.228880Z",
            "url": "https://files.pythonhosted.org/packages/bb/dc/cae4b8284f0e8fd300f6ae82c09f2ed8438b90f38bc22923d434069d486f/topsis_mridul-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 19:20:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mridulmahajan04",
    "github_project": "Topsis_Package",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "topsis-mridul"
}
        
Elapsed time: 2.76398s