Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdPCA: Convert indID from labels DataFrame to string #21

Merged
merged 1 commit into from
Feb 22, 2025
Merged

mdPCA: Convert indID from labels DataFrame to string #21

merged 1 commit into from
Feb 22, 2025

Conversation

miriambt
Copy link
Collaborator

Concept

A bug was identified in mdPCA when processing the labels file, leading to the error below:

ValueError: Found array with 0 sample(s) (shape=(0, 0)) while a minimum of 1 is required by TruncatedSVD.

Issue Description

The error occurs because the indID column in the labels file might contain integer values (e.g., 403). However, the identifiers in laiobj are stored as strings. When filtering with:

labels = np.array(labels_df['label'][labels_df['indID'].isin(temp_ind_IDs)])

the mismatch between integer and string types means that no samples match, resulting in an empty array.

Resolution

To fix this, we ensure that the indID values in the labels file are treated as strings. We convert the indID column immediately after loading the file:

labels_df['indID'] = labels_df['indID'].astype(str)

@miriambt miriambt requested review from salcc and davidbonet February 21, 2025 10:43
@salcc salcc merged commit 004cdfa into main Feb 22, 2025
6 checks passed
@salcc salcc deleted the mdpca branch February 22, 2025 02:04
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.

2 participants