topsis-varun-102217105


Nametopsis-varun-102217105 JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryTechnique for Order Preference by Similarity to Ideal Solution(TOPSIS) Package
upload_time2025-01-17 13:41:43
maintainerNone
docs_urlNone
authorVarun Kumar
requires_python>=3.6
licenseNone
keywords python topsis multi-criteria decision-making mcdm ranking
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TOPSIS Analysis Tool

This project implements the Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) for multi-criteria decision making. The tool takes a decision matrix, applies weights and impacts for each criterion, and ranks the alternatives based on their relative performance. This python package was built under acronym topsis-varun-102217105 as University Student Project.

## Features
- Supports decision matrix input via CSV or Excel files (.xlsx, .xls).
- Allows customizable weights and impacts for each criterion.
- Outputs ranked results in a CSV file.

---

## Installation
1. Clone this repository or download the script file.
2. Ensure you have Python installed (version 3.6 or later).
3. Install the required dependencies using pip:

```bash
pip install numpy pandas openpyxl
```

---

## Usage

The script accepts command-line arguments to specify the input file, weights, impacts, and output file.

### Command
```bash
python topsis.py <input_file> <weights> <impacts> <output_file>
```

### Parameters
- **`<input_file>`**: Path to the input decision matrix file. Accepts `.csv`, `.xlsx`, or `.xls` files.
- **`<weights>`**: Comma-separated weights for each criterion (e.g., `0.3,0.4,0.3`).
- **`<impacts>`**: Comma-separated impacts for each criterion (`+` for beneficial, `-` for non-beneficial, e.g., `+,+,-`).
- **`<output_file>`**: Path to save the output CSV file containing ranks.

### Example
#### Input File (`data.csv`):
| Alternatives | Criterion 1 | Criterion 2 | Criterion 3 |
|--------------|-------------|-------------|-------------|
| A1           | 250         | 16          | 12          |
| A2           | 200         | 20          | 10          |
| A3           | 300         | 18          | 15          |

#### Command:
```bash
python topsis.py data.csv "0.3,0.4,0.3" "+,+,-" output.csv
```

#### Output File (`output.csv`):
| Alternatives | Criterion 1 | Criterion 2 | Criterion 3 | Rank |
|--------------|-------------|-------------|-------------|------|
| A1           | 250         | 16          | 12          | 2    |
| A2           | 200         | 20          | 10          | 3    |
| A3           | 300         | 18          | 15          | 1    |

---

## Functions

### `topsis(data, weights, impacts)`
Performs TOPSIS analysis and returns the ranks of the alternatives.

#### Parameters:
- **`data`**: 2D list or numpy array representing the decision matrix.
- **`weights`**: List of weights for each criterion.
- **`impacts`**: List of impacts (`+` or `-`) for each criterion.

#### Returns:
- List of ranks for the alternatives.

---

### `excel_to_csv(excel_file, csv_output)`
Converts an Excel file to a CSV file.

#### Parameters:
- **`excel_file`**: Path to the Excel file.
- **`csv_output`**: Path to save the converted CSV file.

#### Returns:
- The path to the converted CSV file.

---

## Notes
- Ensure that the weights and impacts match the number of criteria in the decision matrix.
- The decision matrix should not include the alternative names in the criteria columns (e.g., the first column in the input file should contain names like A1, A2, etc.).

---

## License
This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "topsis-varun-102217105",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, topsis, multi-criteria decision-making, mcdm, ranking",
    "author": "Varun Kumar",
    "author_email": "varunkumar2004.vk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/2a/ceb4de4f4599332eb93469afc71be383546555a85222e1b60ee01e16922d/topsis_varun_102217105-0.1.2.tar.gz",
    "platform": null,
    "description": "# TOPSIS Analysis Tool\r\n\r\nThis project implements the Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) for multi-criteria decision making. The tool takes a decision matrix, applies weights and impacts for each criterion, and ranks the alternatives based on their relative performance. This python package was built under acronym topsis-varun-102217105 as University Student Project.\r\n\r\n## Features\r\n- Supports decision matrix input via CSV or Excel files (.xlsx, .xls).\r\n- Allows customizable weights and impacts for each criterion.\r\n- Outputs ranked results in a CSV file.\r\n\r\n---\r\n\r\n## Installation\r\n1. Clone this repository or download the script file.\r\n2. Ensure you have Python installed (version 3.6 or later).\r\n3. Install the required dependencies using pip:\r\n\r\n```bash\r\npip install numpy pandas openpyxl\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\nThe script accepts command-line arguments to specify the input file, weights, impacts, and output file.\r\n\r\n### Command\r\n```bash\r\npython topsis.py <input_file> <weights> <impacts> <output_file>\r\n```\r\n\r\n### Parameters\r\n- **`<input_file>`**: Path to the input decision matrix file. Accepts `.csv`, `.xlsx`, or `.xls` files.\r\n- **`<weights>`**: Comma-separated weights for each criterion (e.g., `0.3,0.4,0.3`).\r\n- **`<impacts>`**: Comma-separated impacts for each criterion (`+` for beneficial, `-` for non-beneficial, e.g., `+,+,-`).\r\n- **`<output_file>`**: Path to save the output CSV file containing ranks.\r\n\r\n### Example\r\n#### Input File (`data.csv`):\r\n| Alternatives | Criterion 1 | Criterion 2 | Criterion 3 |\r\n|--------------|-------------|-------------|-------------|\r\n| A1           | 250         | 16          | 12          |\r\n| A2           | 200         | 20          | 10          |\r\n| A3           | 300         | 18          | 15          |\r\n\r\n#### Command:\r\n```bash\r\npython topsis.py data.csv \"0.3,0.4,0.3\" \"+,+,-\" output.csv\r\n```\r\n\r\n#### Output File (`output.csv`):\r\n| Alternatives | Criterion 1 | Criterion 2 | Criterion 3 | Rank |\r\n|--------------|-------------|-------------|-------------|------|\r\n| A1           | 250         | 16          | 12          | 2    |\r\n| A2           | 200         | 20          | 10          | 3    |\r\n| A3           | 300         | 18          | 15          | 1    |\r\n\r\n---\r\n\r\n## Functions\r\n\r\n### `topsis(data, weights, impacts)`\r\nPerforms TOPSIS analysis and returns the ranks of the alternatives.\r\n\r\n#### Parameters:\r\n- **`data`**: 2D list or numpy array representing the decision matrix.\r\n- **`weights`**: List of weights for each criterion.\r\n- **`impacts`**: List of impacts (`+` or `-`) for each criterion.\r\n\r\n#### Returns:\r\n- List of ranks for the alternatives.\r\n\r\n---\r\n\r\n### `excel_to_csv(excel_file, csv_output)`\r\nConverts an Excel file to a CSV file.\r\n\r\n#### Parameters:\r\n- **`excel_file`**: Path to the Excel file.\r\n- **`csv_output`**: Path to save the converted CSV file.\r\n\r\n#### Returns:\r\n- The path to the converted CSV file.\r\n\r\n---\r\n\r\n## Notes\r\n- Ensure that the weights and impacts match the number of criteria in the decision matrix.\r\n- The decision matrix should not include the alternative names in the criteria columns (e.g., the first column in the input file should contain names like A1, A2, etc.).\r\n\r\n---\r\n\r\n## License\r\nThis project is licensed under the MIT License.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Technique for Order Preference by Similarity to Ideal Solution(TOPSIS) Package",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "python",
        " topsis",
        " multi-criteria decision-making",
        " mcdm",
        " ranking"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66c1f77da802368c593fe90856d91c74c25418dc9e65a49a0cf44892a90ce4f8",
                "md5": "cc97cba42d633da94da12cb3f3d313ec",
                "sha256": "403ab3324d495c48deac012658d7ae93516bb5f9c5116ab304d41c49e139bbb6"
            },
            "downloads": -1,
            "filename": "topsis_varun_102217105-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc97cba42d633da94da12cb3f3d313ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5080,
            "upload_time": "2025-01-17T13:41:42",
            "upload_time_iso_8601": "2025-01-17T13:41:42.208549Z",
            "url": "https://files.pythonhosted.org/packages/66/c1/f77da802368c593fe90856d91c74c25418dc9e65a49a0cf44892a90ce4f8/topsis_varun_102217105-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a2aceb4de4f4599332eb93469afc71be383546555a85222e1b60ee01e16922d",
                "md5": "c37a703ed40d0dbea1e75e131e3cc598",
                "sha256": "a9a88ff762a737f4c3ad811bd89bba27a1074bc27b514a38e2c1bd07ba7f9d8a"
            },
            "downloads": -1,
            "filename": "topsis_varun_102217105-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c37a703ed40d0dbea1e75e131e3cc598",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4534,
            "upload_time": "2025-01-17T13:41:43",
            "upload_time_iso_8601": "2025-01-17T13:41:43.685061Z",
            "url": "https://files.pythonhosted.org/packages/7a/2a/ceb4de4f4599332eb93469afc71be383546555a85222e1b60ee01e16922d/topsis_varun_102217105-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 13:41:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "topsis-varun-102217105"
}
        
Elapsed time: 4.35676s