I have a dataset of mf4 and I want to convert it into CSV in python. I have read the data from mf4 and convert it into csv (as given below) but I am getting an error, as I am new to python, so unable to find an appropriate method to convert.
from asammdf import MDF
import pandas as pd
efficient = MDF('./Data.mf4')
df = efficient.to_csv()
df.append(efficient)
mdf.save('output.csv')
I am getting this error:
MdfException: "Data.mf4" is not a valid ASAM MDF file: magic header is b'timestam'
Kindly suggest. Thank you!
You can use the asammdf package, either by using the API or the GUI.
Install the package and the GUI dependencies:
pip install asammdf[gui]
from asammdf import MDF
mdf = MDF('input.mf4')
mdf.export(fmt='csv', filename='output.csv')
There are other export options that you can use, please check the documentation https://asammdf.readthedocs.io/en/latest/api.html#asammdf.mdf.MDF.export
Start the GUI from the python_installation_folder\Scripts\asammdfgui.exe or by running this script
from asammdf.gui.asammdfgui import main
main()

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With