File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -605,27 +605,36 @@ DataFrame >> calculateDataTypes [
605605
606606{ #category : #comparing }
607607DataFrame >> closeTo: aDataFrame [
608+ " (#(#(1 2) #(3 4)) asDataFrame closeTo: #(#(1.0001 1.9999) #(3 4.0001)) asDataFrame ) >>> true"
609+
610+ " (#(#(1 2) #(3 4)) asDataFrame closeTo: #(#(1 1) #(3 4)) asDataFrame ) >>> false"
608611
609612 aDataFrame species = self species ifFalse: [ ^ false ].
610613
611614 aDataFrame dimensions = self dimensions ifFalse: [ ^ false ].
612615
613- (aDataFrame rowNames = self rowNames and : [ aDataFrame columnNames = self columnNames ]) ifFalse: [ ^ false ].
616+ (aDataFrame rowNames = self rowNames and : [
617+ aDataFrame columnNames = self columnNames ]) ifFalse: [ ^ false ].
614618
615619 1 to: self numberOfRows do: [ :i |
616620 1 to: self numberOfColumns do: [ :j |
617621 | value |
618622 value := self at: i at: j.
619623 (value isNumber
620624 ifTrue: [ value closeTo: (aDataFrame at: i at: j) ]
621- ifFalse: [ value = (aDataFrame at: i at: j) ]) ifFalse: [ ^ false ] ] ].
625+ ifFalse: [ value = (aDataFrame at: i at: j) ]) ifFalse: [
626+ ^ false ] ] ].
622627
623628 ^ true
624629]
625630
626631{ #category : #comparing }
627632DataFrame >> closeTo: aDataFrame precision: epsilon [
628633
634+ " (#(#(1 2) #(3 4)) asDataFrame closeTo: #(#(1.2 2.19) #(3 4)) asDataFrame precision: 0.2 ) >>> true"
635+
636+ " (#(#(1 2) #(3 4)) asDataFrame closeTo: #(#(1.21 2) #(3 4)) asDataFrame precision: 0.2 ) >>> false"
637+
629638 aDataFrame species = self species ifFalse: [ ^ false ].
630639
631640 aDataFrame dimensions = self dimensions ifFalse: [ ^ false ].
You can’t perform that action at this time.
0 commit comments