TypeError: Parameter 'metadata' received Metadata as an argument, which is incompatible with parameter type: MetadataColumn[Categorical]

TypeError: Parameter 'metadata' received Metadata as an argument, which is incompatible with parameter type: MetadataColumn[Categorical]

.get_column('name_of_column_w_categorical_type')

to check if column is numeric/categorical:

!metadata.actions.tabulate?
tabulate = metadata.actions.tabulate(sample_metadata)
tabulate.visualization #displays metadata table and whether columns numeric or categorical

e.g. .get_column('name_of_column_w_categorical_type')

uUniFrac_Subject_significance = diversity.actions.beta_group_significance(core_metrics.unweighted_unifrac_distance_matrix,
sample_metadata.get_column('name_of_column_w_categorical_type'))
1 Like

Hello @kristinachan, what command did you run that created this error? It looks like you passed a Metadata object into a command that requires a Categorical column. In order to get a column you call .get_column("column name") on your Metadata object.

1 Like

the original code that generated the error:

uUniFrac_Subject_significance = diversity.actions.beta_group_significance(core_metrics.unweighted_unifrac_distance_matrix,
sample_metadata)

^i.e. without .get_column()

Was trying to document how I solved it to improve documentation of errors. Thanks for the kind attention! :slight_smile:

1 Like

Oh, thank you! Has the issue been resolved?

Yes, thank you! much appreciated

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.