I have the following data (simple representation of black particles on a white filter):

```
data = [
    [0, 0, 0, 255, 255, 255, 0, 0],
    [0, 255, 0, 255, 255, 255, 0, 0],
    [0, 0, 0, 255, 255, 255, 0, 0, ],
    [0, 0, 0, 0, 255, 0, 0, 0],
    [0, 255, 255, 0, 0, 255, 0, 0],
    [0, 255, 0, 0, 0, 255, 0, 0],
    [0, 0, 0, 0, 0, 255, 0, 0],
    [0, 0, 0, 0, 0, 255, 0, 0]
]

```

And I have counted the number of particles (groups) and assigned them each a number using the following code:

```
arr = np.array(data)
groups, group_count = measure.label(arr > 0, return_num = True, connectivity = 1)
print('Groups: \n', groups)

```

With the **Output**:

```
Groups: 
 [[0 0 0 1 1 1 0 0]
 [0 2 0 1 1 1 0 0]
 [0 0 0 1 1 1 0 0]
 [0 0 0 0 1 0 0 0]
 [0 3 3 0 0 4 0 0]
 [0 3 0 0 0 4 0 0]
 [0 0 0 0 0 4 0 0]
 [0 0 0 0 0 4 0 0]]

```

I then have four (4) particles (groups) of different sizes.

I am looking to create a DataFrame representing each particle. Like this:

[![DataFrame of particles (groups)](https://i.stack.imgur.com/nNuhC.png)](https://i.stack.imgur.com/nNuhC.png)

Any help is much appreciated!