Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Tutorial 8 Medins issue #161

Closed
Bergylta opened this issue Sep 5, 2023 · 0 comments · Fixed by #183
Closed

Tutorial 8 Medins issue #161

Bergylta opened this issue Sep 5, 2023 · 0 comments · Fixed by #183
Assignees
Labels
bug Something isn't working

Comments

@Bergylta
Copy link
Collaborator

Bergylta commented Sep 5, 2023

Input

pp.process_zoo_classifications()

Output

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[86], line 1
----> 1 pp.process_zoo_classifications()

File /usr/src/app/kso/kso_utils/kso_utils/project.py:746, in ProjectProcessor.process_zoo_classifications(self, test)
    742     workflow_checks = self.workflow_widget.checks
    744 # Retrieve a subset of the subjects from the workflows of interest and
    745 # populate the sql subjects table
--> 746 selected_zoo_workflows = zoo_utils.sample_subjects_from_workflows(
    747     project=self.project,
    748     server_connection=self.server_connection,
    749     db_connection=self.db_connection,
    750     workflow_widget_checks=workflow_checks,
    751     workflows_df=self.zoo_info["workflows"],
    752     subjects_df=self.zoo_info["subjects"],
    753 )
    755 # Make sure all the classifications have existing subjects,
    756 # Flatten the classifications provided the cit. scientists
    757 self.processed_zoo_classifications = zoo_utils.process_zoo_classifications(
    758     project=self.project,
    759     db_connection=self.db_connection,
   (...)
    763     selected_zoo_workflows=selected_zoo_workflows,
    764 )

File /usr/src/app/kso/kso_utils/kso_utils/zooniverse_utils.py:1294, in sample_subjects_from_workflows(project, server_connection, db_connection, workflow_widget_checks, workflows_df, subjects_df)
   1290 drop_table(conn=db_connection, table_name="subjects")
   1292 if len(subjects_series) > 0:
   1293     # Fill or re-fill subjects table
-> 1294     populate_subjects(project, server_connection, db_connection, subjects_series)
   1295 else:
   1296     logging.error("No subjects to populate database from the workflows selected.")

File /usr/src/app/kso/kso_utils/kso_utils/zooniverse_utils.py:1169, in populate_subjects(project, server_connection, db_connection, subjects)
   1166         species_df = species_df.rename(columns={"id": "frame_exp_sp_id"})
   1168         # Reference the expected species on the uploaded subjects
-> 1169         subjects = pd.merge(
   1170             subjects,
   1171             species_df,
   1172             how="left",
   1173             on="frame_exp_sp_id",
   1174         )
   1176 else:
   1177     right_types = ["frame", "clip"]

File /usr/local/lib/python3.8/dist-packages/pandas/core/reshape/merge.py:107, in merge(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate)
     90 @Substitution("\nleft : DataFrame or named Series")
     91 @Appender(_merge_doc, indents=0)
     92 def merge(
   (...)
    105     validate: str | None = None,
    106 ) -> DataFrame:
--> 107     op = _MergeOperation(
    108         left,
    109         right,
    110         how=how,
    111         on=on,
    112         left_on=left_on,
    113         right_on=right_on,
    114         left_index=left_index,
    115         right_index=right_index,
    116         sort=sort,
    117         suffixes=suffixes,
    118         copy=copy,
    119         indicator=indicator,
    120         validate=validate,
    121     )
    122     return op.get_result()

File /usr/local/lib/python3.8/dist-packages/pandas/core/reshape/merge.py:704, in _MergeOperation.__init__(self, left, right, how, on, left_on, right_on, axis, left_index, right_index, sort, suffixes, copy, indicator, validate)
    696 (
    697     self.left_join_keys,
    698     self.right_join_keys,
    699     self.join_names,
    700 ) = self._get_merge_keys()
    702 # validate the merge keys dtypes. We may need to coerce
    703 # to avoid incompatible dtypes
--> 704 self._maybe_coerce_merge_keys()
    706 # If argument passed to validate,
    707 # check if columns specified as unique
    708 # are in fact unique.
    709 if validate is not None:

File /usr/local/lib/python3.8/dist-packages/pandas/core/reshape/merge.py:1257, in _MergeOperation._maybe_coerce_merge_keys(self)
   1251     # unless we are merging non-string-like with string-like
   1252     elif (
   1253         inferred_left in string_types and inferred_right not in string_types
   1254     ) or (
   1255         inferred_right in string_types and inferred_left not in string_types
   1256     ):
-> 1257         raise ValueError(msg)
   1259 # datetimelikes must match exactly
   1260 elif needs_i8_conversion(lk.dtype) and not needs_i8_conversion(rk.dtype):

ValueError: You are trying to merge on object and int64 colu
mns. If you wish to proceed you should use pd.concat

@Bergylta Bergylta added the bug Something isn't working label Sep 5, 2023
@victor-wildlife victor-wildlife linked a pull request Sep 14, 2023 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants