""" Sensovation Data Parser Parsing the numerical output from Sensovation image analysis. """ __version__ = "0.0.1" from pathlib import Path import pandas def _guess_decimal_separator(file_handle): file_handle.seek(0) headers = next(file_handle) # noqa: F841 data = next(file_handle) separator = "," if data.count(",") > data.count(".") else "." file_handle.seek(0) return separator def _parse_csv(data_file): data_path = Path(data_file) with data_path.open("r") as handle: decimal_sep = _guess_decimal_separator(handle) df = pandas.read_csv(handle, sep="\t", decimal=decimal_sep) # print(df) return df