load_in_dict_selected¶
-
yoda_powers.toolbox.
load_in_dict_selected
(filename, column_key=0, column_value=1, sep='\t')[source]¶ Check file exist and return a
dict
with load rows first column is the key and value are other column. File can be a gzip file with ‘.gz’ extension.- Parameters
filename (str) – a path to existent file
column_key (int, default) – the index for dict keys (python index). Default=0
column_value (int, default) – the index for dict value (python index). Default=1
sep (str, default) – the string separator. Default=” “
- Returns
a python
dict
of file- Return type
dict
- Raises
FileNotFoundError – If file filename does not exist or not valid file
IndexError – If missing data
Example
>>> dico = load_in_dict(filename) >>> dico { "col1",["col2","col3"], "indiv1",["valeurcol2","valeurcol3"], "indiv2",["valeurcol2","valeurcol3"] }