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

AttributeError in assign class with format_df function. #12

Open
kylacochrane opened this issue Oct 28, 2024 · 0 comments · May be fixed by #14
Open

AttributeError in assign class with format_df function. #12

kylacochrane opened this issue Oct 28, 2024 · 0 comments · May be fixed by #14

Comments

@kylacochrane
Copy link
Collaborator

kylacochrane commented Oct 28, 2024

Description: Encountered the following error messages while testing the cluster address assignment with 2 or fewer levels using GAS version 0.1.2.

Cluster Address(es): 1 level (e.g., 1):
AttributeError: 'int' object has no attribute 'split'

Cluster Address(es): 2 levels (e.g., 1.1):
AttributeError: 'float' object has no attribute 'split'

Possible Cause: Could be in the format_df function in assign.py at line 88:

def format_df(self,data,delim='.'):
num_thresholds = len(self.thresholds)
self.error_samples = []
membership = {}
for sample_id in data:
address = data[sample_id].split(delim)
if len(address) != num_thresholds:
self.error_samples.append(sample_id)
continue
membership[sample_id] = {}
for idx,value in enumerate(address):
l = f'level_{idx}'
try:
value = int(value)
except Exception:
self.error_samples.append(sample_id)
del membership[sample_id]
break
membership[sample_id][l] = int(value)

Proposed Fix: Modify line 88 to convert data[sample_id] to a string before splitting:

address = str(data[sample_id]).split(delim)
@kylacochrane kylacochrane changed the title TypeError in assign class with format_df function. AttributeError in assign class with format_df function. Nov 7, 2024
@kylacochrane kylacochrane linked a pull request Nov 7, 2024 that will close this issue
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 a pull request may close this issue.

1 participant