Skip to content

Commit

Permalink
Try error catch
Browse files Browse the repository at this point in the history
  • Loading branch information
AP6YC committed Jan 12, 2024
1 parent 3ad7537 commit 6f3c29e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Kmeans_Clustering_neurogenetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def main(display=True):
# Convert feature values to binary (0 or 1)
# features = features.applymap(lambda x: 1 if x > 0 else 0)
# features = features.map(lambda x: 1 if x > 0 else 0)
features = features.apply(lambda x: 1 if x > 0 else 0)
try:
features = features.map(lambda x: 1 if x > 0 else 0)
except AttributeError:
features = features.applymap(lambda x: 1 if x > 0 else 0)

X = features

# Perform K-Means clustering (set the number of clusters, e.g., 3)
Expand Down

0 comments on commit 6f3c29e

Please sign in to comment.