# Error with Table.from\_pandas

**URL:** <https://discuss.hail.is/t/error-with-table-from-pandas/2516>\
**Category:** Hail Query & hailctl\
**Created:** [February 21, 2022, 4:48pm UTC](https://discuss.hail.is/t/error-with-table-from-pandas/2516 "2022-02-21T16:48:12Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Ofer](https://avatars.discourse-cdn.com/v4/letter/o/a4c791/32.png) [@Ofer](https://discuss.hail.is/u/Ofer)\
**Post date:** [September 22, 2022, 9:39am UTC](https://discuss.hail.is/t/error-with-table-from-pandas/2516/21 "2022-09-22T09:39:15Z")

</div>

Hi,

I’m getting this error and I’m using Hail version 0.2.95-513139587f57.

Code:

`i = hl.Table.from_pandas(cm_in_genes)`

Error:

```python
---------------------------------------------------------------------------
ExpressionException Traceback (most recent call last)
/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in raise_for_holes(t)
    239 try:
--> 240 raise_for_holes(vt)
    241 except ExpressionException as exc:

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in raise_for_holes(t)
    231 if t is None:
--> 232 raise ExpressionException("Hail cannot impute type")
    233 if t in (tbool, tint32, tint64, tfloat32, tfloat64, tstr, tcall):

ExpressionException: Hail cannot impute type

The above exception was the direct cause of the following exception:

ExpressionException Traceback (most recent call last)
/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in raise_for_holes(t)
    252 try:
--> 253 raise_for_holes(t.element_type)
    254 except ExpressionException as exc:

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in raise_for_holes(t)
    241 except ExpressionException as exc:
--> 242 raise ExpressionException(f'cannot impute field {k}') from exc
    243 return

ExpressionException: cannot impute field chrom

The above exception was the direct cause of the following exception:

ExpressionException Traceback (most recent call last)
/tmp/ipykernel_13276/3652694852.py in <module>
----> 1 i = hl.Table.from_pandas(cm_in_genes)
      2 # i = i.key_by(interval = hl.locus_interval(
      3 # hl.literal('chr') + hl.str(i.chrom),
      4 # i.CM_start,
      5 # i.CM_end

<decorator-gen-1184> in from_pandas(df, key)

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
    575 def wrapper(__original_func, *args, **kwargs):
    576 args_, kwargs_ = check_all(__original_func, args, kwargs, checkers, is_method=is_method)
--> 577 return __original_func(*args_, **kwargs_)
    578 
    579 return wrapper

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/table.py in from_pandas(df, key)
   3406 hl_type_hints[field] = type_hint
   3407 
-> 3408 new_table = hl.Table.parallelize(data, partial_type=hl_type_hints)
   3409 return new_table if not key else new_table.key_by(*key)
   3410 

<decorator-gen-1106> in parallelize(cls, rows, schema, key, n_partitions, partial_type)

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
    575 def wrapper(__original_func, *args, **kwargs):
    576 args_, kwargs_ = check_all(__original_func, args, kwargs, checkers, is_method=is_method)
--> 577 return __original_func(*args_, **kwargs_)
    578 
    579 return wrapper

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/table.py in parallelize(cls, rows, schema, key, n_partitions, partial_type)
    534 if partial_type is not None:
    535 partial_type = hl.tarray(hl.tstruct(**partial_type))
--> 536 rows = to_expr(rows, dtype=dtype, partial_type=partial_type)
    537 if not isinstance(rows.dtype.element_type, tstruct):
    538 raise TypeError("'parallelize' expects an array with element type 'struct', found '{}'"

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in to_expr(e, dtype, partial_type)
    273 raise TypeError("expected expression of type '{}', found expression of type '{}'".format(dtype, e.dtype))
    274 return e
--> 275 return cast_expr(e, dtype, partial_type)
    276 
    277 

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in cast_expr(e, dtype, partial_type)
    279 assert dtype is None or partial_type is None
    280 if not dtype:
--> 281 dtype = impute_type(e, partial_type)
    282 x = _to_expr(e, dtype)
    283 if isinstance(x, Expression):

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in impute_type(x, partial_type)
    128 def impute_type(x, partial_type=None):
    129 t = _impute_type(x, partial_type=partial_type)
--> 130 raise_for_holes(t)
    131 return t
    132 

/cs/labs/michall/ofer.feinstein/my_env/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in raise_for_holes(t)
    253 raise_for_holes(t.element_type)
    254 except ExpressionException as exc:
--> 255 raise ExpressionException('cannot impute array elements') from exc
    256 return
    257 if isinstance(t, tdict):

ExpressionException: cannot impute array elements

```

Thanks 🙂

[Previous page](https://discuss.hail.is/t/error-with-table-from-pandas/2516.md?page=1)
