Source code for piel.file_conversion
import pandas as pd
from .file_system import return_path
from .types import PathTypes
__all__ = [
"read_csv_to_pandas",
"read_vcd_to_json",
]
[docs]def read_csv_to_pandas(file_path: PathTypes):
"""
This function returns a Pandas dataframe that contains all the simulation data outputted from the simulation run.
"""
file_path = return_path(file_path)
simulation_data = pd.read_csv(file_path)
return simulation_data
[docs]def read_vcd_to_json(file_path: PathTypes):
from pyDigitalWaveTools.vcd.parser import VcdParser
file_path = return_path(file_path)
with open(str(file_path.resolve())) as vcd_file:
vcd = VcdParser()
vcd.parse(vcd_file)
json_data = vcd.scope.toJson()
return json_data