TypeError: import_table: parameter 'types': expected Mapping[str, (hail.expr.types.HailType or (str))], found dict:


#1

Hi,

I’m trying to load a table and impose field type and am following the manual but get an error, as if it was not indeed expecting a dictionary.

https://hail.is/docs/0.2/methods/impex.html?highlight=import_table#hail.methods.import_table

pheno = hl.import_table('/mnt/phenotypes.txt', impute=False, delimiter='\s+', types={'ID_2': str, 'missing' : hl.tint32}).key_by('ID_2')

TypeError: import_table: parameter ‘types’: expected Mapping[str, (hail.expr.types.HailType or (str))], found dict: {‘ID_2’: <class ‘str’>, ‘missing’: dtype(‘int32’)}

Any idea what I’m doing wrong?


#2

str isn’t a hail type - this should be either hl.tstr or 'str'(which will be automatically parsed by hl.dtype)


#3

Argh… of course, thank you.