# Numba with Dicts & np.zeros

**URL:** <https://numba.discourse.group/t/numba-with-dicts-np-zeros/312>\
**Category:** Support: What is this error message?\
**Created:** [October 23, 2020, 7:45pm UTC](https://numba.discourse.group/t/numba-with-dicts-np-zeros/312 "2020-10-23T19:45:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wilky\_way](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/wilky_way/32/130_2.png) [@wilky\_way](https://numba.discourse.group/u/wilky_way)\
**Post date:** [October 23, 2020, 7:45pm UTC](https://numba.discourse.group/t/numba-with-dicts-np-zeros/312/1 "2020-10-23T19:45:30Z")

</div>

Hi,

I’m new to numba, but excited by what I’ve read about it so far.

I’ve got a function like this:

import numba  
from numba import jit, types  
from numba.typed import Dict

@jit(nopython=True)  
def metrics\_from\_matrix(confusion\_matrix):  
zero\_matrix = np.zeros(confusion\_matrix.shape, dtype=numba.int32)  
metrics = Dict.empty(  
key\_type=types.unicode\_type,  
value\_type=types.float64  
)  
…

I get a ‘non-precise type array(pyobject,1d,C)’ error on the “zero\_matrix” line, and if I comment that out, on the “metrics = Dict” line as well. The full example is here: [https://pastebin.com/yUd4EeXq](https://pastebin.com/yUd4EeXq)

Any ideas on how to fix this?

thank you

---

<div class="post-metadata">

**Author:** ![luk-f-a](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/luk-f-a/32/56_2.png) [@luk-f-a](https://numba.discourse.group/u/luk-f-a)\
**Post date:** [October 23, 2020, 10:23pm UTC](https://numba.discourse.group/t/numba-with-dicts-np-zeros/312/2 "2020-10-23T22:23:27Z")

</div>

this means that there’s an array that contains python objects, instead of a dtype like integer or float. Probably the `labels` variable which seems to be strings coming from a dataframe. Numba cannot handle arrays of `object` type.  
you could try converting that array to a `typed.List` [https://numba.pydata.org/numba-doc/dev/reference/pysupported.html#typed-list](https://numba.pydata.org/numba-doc/dev/reference/pysupported.html#typed-list)
