idmtools.utils.file_parser module¶
File parser utility. Used to automatically load data.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.utils.file_parser.FileParser¶
Bases:
object
FileParser to load contents in analysis.
- classmethod parse(filename, content=None)¶
Parse filename and load the content.
- Parameters:
filename – Filename to load
content – Content to load
- Returns:
Content loaded
- classmethod load_json_file(filename, content) Dict ¶
Load JSON File.
- Parameters:
filename – Filename to load
content – Content
- Returns:
JSOn as dict
- classmethod load_raw_file(filename, content)¶
Load content raw.
- Parameters:
filename – Filename is none
content – Content to load
- Returns:
Content as it was
- classmethod load_csv_file(filename, content) pandas.core.frame.DataFrame ¶
Load csv file.
- Parameters:
filename – Filename to load
content – Content is loading
- Returns:
Loaded csv file
- classmethod load_xlsx_file(filename, content) Dict[str, pandas.io.excel._base.ExcelFile] ¶
Load excel_file.
- Parameters:
filename – Filename to load
content – Content to load
- Returns:
Loaded excel file
- classmethod load_txt_file(filename, content)¶
Load text file.
- Parameters:
filename – Filename to load
content – Content to load
- Returns:
Content
- classmethod load_bin_file(filename, content)¶
Load a bin file.
- Parameters:
filename – Filename to load
content – Content to load
- Returns:
Loaded bin file
Notes
We should move this to a plugin in emodpy. We need to figure out how to structure that.