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

Bug if no significant results (e.g. from meme) #67

Open
fwzhao opened this issue Jun 15, 2020 · 0 comments
Open

Bug if no significant results (e.g. from meme) #67

fwzhao opened this issue Jun 15, 2020 · 0 comments

Comments

@fwzhao
Copy link
Collaborator

fwzhao commented Jun 15, 2020

# collect enrichments
if serial:
# read/parse, label and append
for name, df, function, kwargs, suffix, _ in possible_steps:
if name in steps:
enr = function(
get_this_file_or_timestamped(os.path.join(comparison_dir, suffix)),
**kwargs
)
enr.loc[:, "comparison_name"] = comp
enr.loc[:, "direction"] = direction
enr.loc[:, "label"] = "{}.{}".format(comp, direction)
df.append(enr)

If there are no enrichments (e.g. nothing out of meme), the subsequent lines of code cause a "ValueError: cannot set a frame with no defined index and a scalar" since there are no results (enr is an empty dataframe).

The solution would be to add this tiny if statement - if not enr.empty:

            # collect enrichments
            if serial:
                # read/parse, label and append
                for name, df, function, kwargs, suffix, _ in possible_steps:
                    if name in steps:
                        enr = function(
                            get_this_file_or_timestamped(
                                os.path.join(comparison_dir, suffix)),
                            **kwargs)
                        if not enr.empty:
                            enr.loc[:, "comparison_name"] = comp
                            enr.loc[:, "direction"] = direction
                            enr.loc[:, "label"] = "{}.{}".format(
                                comp, direction)
                            df.append(enr)
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

No branches or pull requests

1 participant