Skip to content

Commit cb9df4d

Browse files
authored
Update ComputeWeightedIndex.py
Cast numbers to float.
1 parent a8c08fa commit cb9df4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Scripts/ComputeWeightedIndex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Name: ComputeWeightedIndex.py
22
# Purpose: This function will return a weighted index based on the input feature class and the input variable weight value table.
33
# Author: David Wasserman
4-
# Last Modified: 6/29/2024
4+
# Last Modified: 3/6/2025
55
# Copyright: David Wasserman
66
# Python Version: 3.9
77
# ArcGIS Version: 3.2 Pro
@@ -75,9 +75,9 @@ def compute_weighted_index(
7575
for key in weight_dict:
7676
weight = weight_dict[key]
7777
if output_field_name in df.columns:
78-
df[output_field_name] = df[var] * weight + df[output_field_name]
78+
df[output_field_name] = df[var].astype(float) * float(weight) + df[output_field_name]
7979
else:
80-
df[output_field_name] = df[var] * weight
80+
df[output_field_name] = df[var].astype(float) * float(weight)
8181

8282
# Prepare for export
8383
JoinField = arcpy.ValidateFieldName("DFIndexJoin", workspace)

0 commit comments

Comments
 (0)