topsis-pranshu-102313009 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {topsis_pranshu_102313009-1.0.2/topsis_pranshu_102313009.egg-info → topsis_pranshu_102313009-1.0.3}/PKG-INFO +1 -1
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/setup.py +1 -1
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu/topsis.py +17 -9
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3/topsis_pranshu_102313009.egg-info}/PKG-INFO +1 -1
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/LICENSE +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/README.md +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/setup.cfg +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu/__init__.py +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu_102313009.egg-info/SOURCES.txt +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu_102313009.egg-info/dependency_links.txt +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu_102313009.egg-info/entry_points.txt +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu_102313009.egg-info/requires.txt +0 -0
- {topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu_102313009.egg-info/top_level.txt +0 -0
|
@@ -39,18 +39,23 @@ def main():
|
|
|
39
39
|
if df.shape[1] < 3:
|
|
40
40
|
error("Input file must contain at least 3 columns")
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
# Keep first column as alternative name
|
|
43
|
+
alternatives = df.iloc[:, 0]
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
# Automatically select ONLY numeric columns (criteria)
|
|
46
|
+
data = df.iloc[:, 1:].select_dtypes(include=[np.number])
|
|
47
|
+
|
|
48
|
+
if data.shape[1] < 1:
|
|
49
|
+
error("No numeric criteria columns found")
|
|
48
50
|
|
|
49
51
|
weights = list(map(float, weights.split(",")))
|
|
50
52
|
impacts = impacts.split(",")
|
|
51
53
|
|
|
52
54
|
if len(weights) != len(impacts) or len(weights) != data.shape[1]:
|
|
53
|
-
error(
|
|
55
|
+
error(
|
|
56
|
+
f"Weights ({len(weights)}), impacts ({len(impacts)}) "
|
|
57
|
+
f"and criteria ({data.shape[1]}) count mismatch"
|
|
58
|
+
)
|
|
54
59
|
|
|
55
60
|
if not all(i in ['+', '-'] for i in impacts):
|
|
56
61
|
error("Impacts must be + or -")
|
|
@@ -78,10 +83,13 @@ def main():
|
|
|
78
83
|
|
|
79
84
|
score = d_neg / (d_pos + d_neg)
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
result = pd.DataFrame({
|
|
87
|
+
df.columns[0]: alternatives,
|
|
88
|
+
"Topsis Score": score,
|
|
89
|
+
"Rank": score.rank(ascending=False).astype(int)
|
|
90
|
+
})
|
|
83
91
|
|
|
84
|
-
|
|
92
|
+
result.to_csv(output_file, index=False)
|
|
85
93
|
print("TOPSIS completed successfully")
|
|
86
94
|
|
|
87
95
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{topsis_pranshu_102313009-1.0.2 → topsis_pranshu_102313009-1.0.3}/topsis_pranshu/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|