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

Gromacs parser cannot handle incomplete lines with - #171

Closed
xiki-tempula opened this issue Oct 18, 2021 · 0 comments · Fixed by #183
Closed

Gromacs parser cannot handle incomplete lines with - #171

xiki-tempula opened this issue Oct 18, 2021 · 0 comments · Fixed by #183
Labels

Comments

@xiki-tempula
Copy link
Collaborator

For an incomplete line like

1 -100 -10 -

The last - will be giving problems as it cannot be cast as a float during
https://github.com/xiki-tempula/alchemlyb/blob/093ad87eca736f724c9a4b4d6843043ea9861f69/src/alchemlyb/parsing/gmx.py#L308

where dtype=np.float64 would enforce it to be a float and - will give

File "/Users/XXX/opt/miniconda3/envs/mda_dev/lib/python3.7/site-packages/pandas/io/parsers.py", line 610, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/Users/XXX/opt/miniconda3/envs/mda_dev/lib/python3.7/site-packages/pandas/io/parsers.py", line 468, in _read
    return parser.read(nrows)
  File "/Users/XXX/opt/miniconda3/envs/mda_dev/lib/python3.7/site-packages/pandas/io/parsers.py", line 1057, in read
    index, columns, col_dict = self._engine.read(nrows)
  File "/Users/XXX/opt/miniconda3/envs/mda_dev/lib/python3.7/site-packages/pandas/io/parsers.py", line 2061, in read
    data = self._reader.read(nrows)
  File "pandas/_libs/parsers.pyx", line 756, in pandas._libs.parsers.TextReader.read
  File "pandas/_libs/parsers.pyx", line 771, in pandas._libs.parsers.TextReader._read_low_memory
  File "pandas/_libs/parsers.pyx", line 850, in pandas._libs.parsers.TextReader._read_rows
  File "pandas/_libs/parsers.pyx", line 982, in pandas._libs.parsers.TextReader._convert_column_data
  File "pandas/_libs/parsers.pyx", line 1056, in pandas._libs.parsers.TextReader._convert_tokens
ValueError: could not convert string to float: '-'
orbeckst pushed a commit that referenced this issue Apr 13, 2022
* Fix #126 and #171 
* more robust gmx parser: skip NaN and incomplete lines in XVG files with filter=True; performance seems similar
  (see PR #183)
* filter=True is now DEFAULT
* add tests; set older tests to use filter=False for backwards-compatibility
* Update CHANGES
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 a pull request may close this issue.

1 participant