-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
DataFrame#to_wide
returns wrong wide table when rows are not ordered.
wide = DataFrame.new(
rows: %w[row1 row2],
Column1: [1.1, 1.2],
Column2: [2.1, 2.2]
)
wide
=>
#<RedAmber::DataFrame : 2 x 3 Vectors, 0x00000000004422e4>
rows Column1 Column2
<string> <double> <double>
0 row1 1.1 2.1
1 row2 1.2 2.2
long = wide.to_long(:rows)
=>
#<RedAmber::DataFrame : 4 x 3 Vectors, 0x00000000004760f8>
rows NAME VALUE
<string> <string> <double>
0 row1 Column1 1.1
1 row1 Column2 2.1
2 row2 Column2 2.2
3 row2 Column1 1.2
long.to_wide == wide
=>
true
shuffled = long.shuffle
shuffle
=>
#<RedAmber::DataFrame : 4 x 3 Vectors, 0x0000000000516850>
rows NAME VALUE
<string> <string> <double>
0 row1 Column1 1.1
1 row2 Column2 2.2
2 row2 Column1 1.2
3 row1 Column2 2.1
shuffled.to_wide
=>
#<RedAmber::DataFrame : 2 x 3 Vectors, 0x000000000052ec84>
rows Column1 Column2
<string> <double> <double>
0 row1 1.1 2.1
1 row2 2.2 1.2
shuffled.to_wide == wide
=>
false
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working