Explorer.DataFrame.group_by slice help

require Explorer.DataFrame, as: DF
df = Explorer.DataFrame.new(%{id: [1, 2, 3, 4], name: ["Raj", "Tara", "Bobby", "Anita"], gender: ["m", "f", "m", "f"]}) 
grouped = df |> DF.group_by("gender") 

grouped |> DF.table gives

+---------------------------------------------+
|  Explorer DataFrame: [rows: 4, columns: 3]  |
+--------------+---------------+--------------+
|    gender    |      id       |     name     |
|   <string>   |   <integer>   |   <string>   |
+==============+===============+==============+
| m            | 1             | Raj          |
+--------------+---------------+--------------+
| m            | 3             | Bobby        |
+--------------+---------------+--------------+
| f            | 2             | Tara         |
+--------------+---------------+--------------+
| f            | 4             | Anita        |
+--------------+---------------+--------------+

grouped |> DF.slice(0…0) |> DF.table gives

+---------------------------------------------+
|  Explorer DataFrame: [rows: 2, columns: 3]  |
+--------------+---------------+--------------+
|    gender    |      id       |     name     |
|   <string>   |   <integer>   |   <string>   |
+==============+===============+==============+
| m            | 1             | Raj          |
+--------------+---------------+--------------+
| f            | 2             | Tara         |
+--------------+---------------+--------------+

Since it’s grouped on gender I was expecting

+---------------------------------------------+
|  Explorer DataFrame: [rows: 2, columns: 3]  |
+--------------+---------------+--------------+
|    gender    |      id       |     name     |
|   <string>   |   <integer>   |   <string>   |
+==============+===============+==============+
| m            | 1             | Raj          |
+--------------+---------------+--------------+
| m            | 3             | Bobby        |
+--------------+---------------+--------------+

What am I missing?

When you group in Explorer, you can think you divide your dataframe into several groups, and the operations often apply to the groups individually and then are put together. In this case, you are slicing each group. So you are getting one entry from each gender.

I get it now. Thanks!