Skip to content

Fix bug in cluster_centroids() function#245

Merged
jenniferfedor merged 1 commit intodevelopfrom
feature/fix-centroids-bug
Dec 4, 2025
Merged

Fix bug in cluster_centroids() function#245
jenniferfedor merged 1 commit intodevelopfrom
feature/fix-centroids-bug

Conversation

@jenniferfedor
Copy link
Collaborator

This PR fixes a minor bug that can occur when processing phone locations features with the DORYAB provider. When the stationary data without outliers are empty, we get the following error when attempting to compute the top n significant locations cluster centroid features: KeyError: 'local_segment'. This occurs because when the input data for clustering are empty, the output of the cluster_centroids() function contains an unexpected "index" column and is missing the expected "local_segment" and "cluster_label" columns. To fix this, we drop the "index" column if present and add the "local_segment" and "cluster_label" columns if missing from the centroids dataframe.

@jenniferfedor jenniferfedor merged commit a6b105c into develop Dec 4, 2025
2 checks passed
@jenniferfedor jenniferfedor deleted the feature/fix-centroids-bug branch December 4, 2025 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant