-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi all,
Snakemake version
9.16.2
Describe the bug
While searching content within a pandas.DataFrame with the function lookup, if there is no row matching results, then default value should be returned. It is not.
Logs
See example below.
Minimal example
The following dummy example does not even require to run Snakemake itself and can be used in a python console. However, the very same behavior occurs within a Snakefile.
import pandas as pd
import numpy as np
import snakemake.ioutils as siou
df = pd.DataFrame(
[
[np.nan, 2.0,],
[3.0, 4.0,],
[np.nan, np.nan,],
[np.nan, 3.0,],
],
)
df.columns=["Zero", "One",]
siou.lookup(query=f"Zero == 4.0", within=df, default=5.0)This returns [] and not 5.0
Additional context
When looking into dictionaries, everything works fine and default value is returned.
Thanks in advance for your insight
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done