# Multi index writting in dense arrays

**URL:** <https://forum.tiledb.com/t/multi-index-writting-in-dense-arrays/762>\
**Category:** Uncategorized\
**Created:** [January 15, 2025, 9:58pm UTC](https://forum.tiledb.com/t/multi-index-writting-in-dense-arrays/762 "2025-01-15T21:58:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoshi](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/yoshi/32/360_2.png) [@yoshi](https://forum.tiledb.com/u/yoshi)\
**Post date:** [January 15, 2025, 9:58pm UTC](https://forum.tiledb.com/t/multi-index-writting-in-dense-arrays/762/1 "2025-01-15T21:58:16Z")

</div>

Hello,  
I have a tiledb array, and given a set of rows, i would like to update said rows by assigning it a matrix:

```auto
index=[0,2,4]
with tiledb.open("dense_array1", 'w') as A:
    A[index,:] = data[index,:]

```

but i get the error:

```auto
IndexError: invalid index type: <class 'list'>

```

And when trying to use `multi_index`, it get:

```auto
TypeError: 'MultiRangeIndexer' object does not support item assignment

```

I found in the documentation:

```auto
Dense Writes
A dense write is applicable to dense arrays and creates one or more dense fragments. In a dense write, the user provides:

The subarray to write into (it must be single-range).

```

So, is it correct my understanding that there is no straightforward way to do this? If not, is the best way to update a row would be to individually update each row?  
Thnx!

---

<div class="post-metadata">

**Author:** ![ihnorton](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/ihnorton/32/23_2.png) [@ihnorton](https://forum.tiledb.com/u/ihnorton)\
**Post date:** [January 16, 2025, 10:36pm UTC](https://forum.tiledb.com/t/multi-index-writting-in-dense-arrays/762/2 "2025-01-16T22:36:33Z")

</div>

Hi @yoshi, dense arrays only support contiguous range (slice) assignment. If you need to update discontiguous coordinates frequently, then a sparse array may be a better option.

---

<div class="post-metadata">

**Author:** ![yoshi](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/yoshi/32/360_2.png) [@yoshi](https://forum.tiledb.com/u/yoshi)\
**Post date:** [January 16, 2025, 10:50pm UTC](https://forum.tiledb.com/t/multi-index-writting-in-dense-arrays/762/3 "2025-01-16T22:50:46Z")

</div>

the problem is that is a complete full dense array (in my case a feature matrix, where millions of samples have thousands of values), my intuition tells me that changing such dense array would come with giant performance penalties.
