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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: topsis-pranshu-102313009
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: TOPSIS command-line tool
5
5
  Author: Pranshu Goel
6
6
  Author-email: your@email.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="topsis-pranshu-102313009",
5
- version="1.0.2",
5
+ version="1.0.3",
6
6
  author="Pranshu Goel",
7
7
  author_email="your@email.com",
8
8
  description="TOPSIS command-line tool",
@@ -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
- data = df.iloc[:, 1:]
42
+ # Keep first column as alternative name
43
+ alternatives = df.iloc[:, 0]
43
44
 
44
- try:
45
- data = data.astype(float)
46
- except:
47
- error("Columns from 2nd onward must be numeric")
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("Weights, impacts and criteria count mismatch")
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
- df["Topsis Score"] = score
82
- df["Rank"] = score.rank(ascending=False).astype(int)
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
- df.to_csv(output_file, index=False)
92
+ result.to_csv(output_file, index=False)
85
93
  print("TOPSIS completed successfully")
86
94
 
87
95
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: topsis-pranshu-102313009
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: TOPSIS command-line tool
5
5
  Author: Pranshu Goel
6
6
  Author-email: your@email.com