About examples in format validation from inmemorydatasets documents

Hi, I am relatively new to Julia, I can’t find the example for content inside red lines, can someone please make an example? How to show in Julia that changing the definition of the formats destroys the sorting order of the data set?

image
Thanks for any help!!!

something like:

ds=Dataset(x=[1,10,2,5,3]);
fmt(x)=x==10
setformat!(ds,:x=>fmt);
groupby!(ds,:x,mapformats=true)

output:

5Γ—1 Grouped Dataset with 2 groups
Grouped by: x
 Row β”‚ x      
     β”‚ fmt    
     β”‚ Int64? 
─────┼────────
   1 β”‚  false
   2 β”‚  false
   3 β”‚  false
   4 β”‚  false
   5 β”‚   true

now change the definition of fmt

fmt(x)=isodd(x)
ds

output:

5Γ—1 Grouped Dataset with 2 groups
Grouped by: x
 Row β”‚ x      
     β”‚ fmt    
     β”‚ Int64? 
─────┼────────
   1 β”‚   true
   2 β”‚  false
   3 β”‚   true
   4 β”‚   true
   5 β”‚  false

ds’s destroyed. It is not sorted, but it says 5Γ—1 Grouped Dataset with 2 groups Grouped by: x

1 Like