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

Reading mpt or mpr files with comma as decimal #17

Open
NilsBuett opened this issue Apr 23, 2024 · 3 comments
Open

Reading mpt or mpr files with comma as decimal #17

NilsBuett opened this issue Apr 23, 2024 · 3 comments

Comments

@NilsBuett
Copy link

Hallo Nicolas,

I want to read mpt or mpr Files 'to_df' but due to the german system we are working on our decimal separators are comma. Is there a way to replace all comma with dots during import.

Example:
df = eclabfiles.to_df(filename)

My df type for a comma value is a tuple. For example I have got a value of 2,5V in my df the value is 2,5 but as [2, 5]. Do I need to combine all tuples and convert them to float?

@PeterKraus
Copy link

Hello Nils, we've added locale support to the mpt parsers in the maintained version of this extractor, see yadg.

Long story short, if you're extracting a mpt file on the same PC (i.e. the locale of the file and of your PC is consistent), it should just work, using:

from yadg.extractors import extract

dataset = extract(filetype="eclab.mpt", path="your_file.mpt")

Note that this returns an xarray.Dataset, not a pandas.DataFrame, so you have to have xarray installed. If you're extracting on a different machine and the locales might be different, please open an issue in the yadg repo and we can assist you.

@NilsBuett
Copy link
Author

I'll give it a try and if it doesn't work, I'll get back to you.

@NilsBuett
Copy link
Author

Okay I have opened an issue in the yadg repo, cause it is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants