Skip to content

Commit 05f0be0

Browse files
Added runnable examples for #argmax and #argmin.
1 parent 64b9280 commit 05f0be0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/DataFrame/DataSeries.class.st

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,21 @@ DataSeries >> adaptToCollection: rcvr andSend: selector [
115115
DataSeries >> argmax [
116116
"Returns the key which corresponds to the maximum value of the dataseries"
117117

118+
"(#(100 10 20 30) asDataSeries argmax) >>> 1"
119+
120+
"((DataSeries withKeys: #(A B C) values: #(1 2 40)) argmax) >>> #C"
121+
118122
^ self keyAtValue: self max
119123
]
120124

121125
{ #category : #statistics }
122126
DataSeries >> argmin [
123127
"Returns the key which corresponds to the minimum value of the dataseries"
124128

129+
"(#(100 10 20 30) asDataSeries argmin) >>> 2"
130+
131+
"((DataSeries withKeys: #(A B C) values: #(1 2 40)) argmin) >>> #A"
132+
125133
^ self keyAtValue: self min
126134
]
127135

0 commit comments

Comments
 (0)