Skip to content

Commit

Permalink
catch maxValue - minValue division by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
TahiriNadia authored Nov 22, 2024
1 parent 5be0b70 commit 23ff4b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aphylogeo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def getDissimilaritiesMatrix(df, columnWithSpecimenName, columnToSearch):

# Calculate normalised matrix
tabDf = pd.DataFrame(tempTab)
dmDf = (tabDf - minValue) / (maxValue - minValue)
if (maxValue - minValue) != 0:
dmDf = (tabDf - minValue) / (maxValue - minValue)
else:
dmDf = 0.0
dmDf = dmDf.round(6)

matrix = [dmDf.iloc[i, : i + 1].tolist() for i in range(len(dmDf))]
Expand Down

0 comments on commit 23ff4b7

Please sign in to comment.