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

DASware5Parser.parse raises ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() #9

Open
lk96er opened this issue Aug 31, 2022 · 1 comment
Labels
question Further information is requested

Comments

@lk96er
Copy link

lk96er commented Aug 31, 2022

Hi, when parsing my v5 file, an ValueError is raised by the function DASware5Parser.parse().
The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()


ValueError Traceback (most recent call last)
/Users/01_Basic_Use.ipynb Cell 4 in <cell line: 6>()
3 import ipywidgets
5 import detl
----> 6 ddata = detl.parse('v5_Control_1_.csv')
8 # display what the ddata object looks like
9 ddata

File ~/opt/anaconda3/lib/python3.9/site-packages/detl/init.py:61, in parse(filepath, inoculation_times)
46 """Parses a raw DASware CSV file into a DWData object.
47
48 Args:
(...)
58 NotImlementedError: when the file contents do not match with a known DASware CSV style
59 """
60 parser = get_parser(filepath)
---> 61 data = parser.parse(filepath)
63 if inoculation_times:
64 for r, dt_inoculate in inoculation_times.items():

File ~/opt/anaconda3/lib/python3.9/site-packages/detl/parsing/dw5.py:137, in DASware5Parser.parse(self, filepath)
134 dd = common.transform_to_dwdata(scoped_blocks, BLOCKPARSERS, version=core.DASwareVersion.V5)
136 for _, reactor in dd.items():
--> 137 reactor._dataframe = common.transform_trackdata(reactor.trackdata, columnmapping, core.DASwareVersion.V5)
...
1528 f"The truth value of a {type(self).name} is ambiguous. "
1529 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
1530 )

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

As far as I could see, the error is produced in common.py in transform_trackdata()

    for key, reg in columnmapping.items():
        new_data = trackdata.filter(regex=reg, axis="columns").squeeze()
        if (not new_data.empty) & (not new_data.isnull().all()):
            transformed_data.loc[:, key] = new_data
            
    transformed_data = transformed_data.fillna(method="ffill")
@michaelosthege
Copy link
Member

Hi @lk96er, sorry for not responding for so long. My notification settings weren't right..

Since this problem does not appear with any of our test datasets, I would suspect that it might be a matter of how the data was exported. Can you provide more information about that? Also, hopefully did you solve the problem in the meantime?

@michaelosthege michaelosthege added the question Further information is requested label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants