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

Properly check whether dataframe is empty #394

Merged
merged 1 commit into from
Nov 4, 2021
Merged

Conversation

andersy005
Copy link
Member

@andersy005 andersy005 commented Nov 4, 2021

Change Summary

Fixes valueError when checking whether the dataframe is empty

--> 323         esmcat_results = self.esmcat.search(require_all_on=require_all_on, query=query)
    324 
    325         # step 2: Search for entries required to derive variables in the derived catalogs

/glade/work/abanihi/devel/intake/intake-esm/intake_esm/cat.py in search(self, query, require_all_on)
    316             df=self.df, query=_query.query, columns_with_iterables=self.columns_with_iterables
    317         )
--> 318         if _query.require_all_on is not None and results:
    319             results = search_apply_require_all_on(
    320                 df=results, query=_query.query, require_all_on=_query.require_all_on

/glade/work/abanihi/opt/miniconda/envs/playground/lib/python3.8/site-packages/pandas/core/generic.py in __nonzero__(self)
   1535     @final
   1536     def __nonzero__(self):
-> 1537         raise ValueError(
   1538             f"The truth value of a {type(self).__name__} is ambiguous. "
   1539             "Use a.empty, a.bool(), a.item(), a.any() or a.all()."

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Related issue number

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable

@andersy005 andersy005 added this to the Winter 2021 Release milestone Nov 4, 2021
@andersy005 andersy005 marked this pull request as ready for review November 4, 2021 16:50
@andersy005 andersy005 merged commit 9198159 into main Nov 4, 2021
@andersy005 andersy005 deleted the bugfix/require_all_on branch November 4, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant