PEtab-dev / PEtab

PEtab - an SBML and TSV based data format for parameter estimation problems in systems biology
https://petab.readthedocs.io
MIT License
59 stars 12 forks source link

Make float parsing from CSV round-trip #444

Closed lcontento closed 4 years ago

lcontento commented 4 years ago

pandas uses by default a C parser for CSV files for performance reasons. The default behaviour of such parser when parsing floating point values from strings is different from Python's behaviour. While Python parsing can be round-tripped (e.g., float(0.999) == 0.999) this is not true for the C parser. I believe most users nowadays expect floats to be parsed correctly, so I added a keyword argument to all instances of pandas.read_csv asking for the Python-like behaviour. The only downside is that this behaviour is slower (the C code actually calls Python to perform the parsing). This may be more relevant for the parameter table and less important for measurement tables, so it may also be acceptable to enable it only for some tables and not others.

codecov[bot] commented 4 years ago

Codecov Report

Merging #444 into develop will not change coverage. The diff coverage is 78.57%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #444   +/-   ##
========================================
  Coverage    77.88%   77.88%           
========================================
  Files           22       22           
  Lines         2211     2211           
  Branches       529      529           
========================================
  Hits          1722     1722           
  Misses         363      363           
  Partials       126      126           
Impacted Files Coverage Δ
petab/sbml.py 51.66% <0.00%> (ø)
petab/visualize/plotting_config.py 56.98% <66.66%> (ø)
petab/conditions.py 90.47% <100.00%> (ø)
petab/core.py 82.91% <100.00%> (ø)
petab/measurements.py 80.24% <100.00%> (ø)
petab/observables.py 96.61% <100.00%> (ø)
petab/parameters.py 82.43% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c34e7a9...a4f8e4b. Read the comment docs.

lcontento commented 4 years ago

I resolved some flake8 errors to make CI succeed, but Codacy says that its checks are not enabled for the PR branch.

yannikschaelte commented 4 years ago

codacy is a bit shy sometimes.