# Replace values in a dictionary of NumPy arrays and single numbers with sums

You could do this using dict comprehension:

```
di = {key:np.sum(value) for (key,value) in di.items()}
```

But fixing the error that was pointed out in the comments would do the job as well.

you can use *dictionary comprehension:*

```
x = {key: np.sum(value) for key, value in dict_.items()}
```

You can try it:

```
new_dict = dict()
for k, v in dict_name.items():
if not isinstance(v, int):
new_dict[k] = sum(v)
```