Skip to content

Commit fa00a1d

Browse files
authored
Merge pull request #287 from olekscode/285-Rename-removeRowsOfColumnElementsSatisfying-onColumn-and-removeRowsOfColumnElementsSatisfing-onColumnNamed
Fixed #285. Renamed removeRowsOfColumnElementsSatisfying: onColumn: a…
2 parents a37feeb + 89681f0 commit fa00a1d

12 files changed

+470
-477
lines changed

src/DataFrame-Tests/DataFrameInternalTest.class.st

+15-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Class {
44
#instVars : [
55
'df'
66
],
7-
#category : 'DataFrame-Tests-Core'
7+
#category : #'DataFrame-Tests-Core'
88
}
99

1010
{ #category : #running }
@@ -322,22 +322,23 @@ DataFrameInternalTest >> testRemoveRowAt [
322322
]
323323

324324
{ #category : #tests }
325-
DataFrameInternalTest >> testRemoveRowsOfColumnElementsSatisfyingOnColumn [
325+
DataFrameInternalTest >> testRemoveRowsWhereElementsInColumnAtSatisfy [
326326

327327
| expected |
328+
df := DataFrameInternal withRows:
329+
#( #( 'Barcelona' 1.609 nil ) #( 'Dubai' 2.789 true )
330+
#( 'London' 8.788 nil ) #( 'Washington' nil true )
331+
#( 'Delhi' 10.422 nil ) ).
328332

329-
df := DataFrameInternal withRows: #(
330-
('Barcelona' 1.609 nil)
331-
('Dubai' 2.789 true)
332-
('London' 8.788 nil)
333-
('Washington' nil true)
334-
('Delhi' 10.422 nil)).
335-
336-
expected := DataFrameInternal withRows: #(
337-
('Dubai' 2.789 true)
338-
('Washington' nil true)).
339-
340-
self assert: (df removeRowsOfColumnElementsSatisfying: [ :ele | ele isNil ] onColumn: 3) equals: expected
333+
expected := DataFrameInternal withRows:
334+
#( #( 'Dubai' 2.789 true ) #( 'Washington' nil true ) ).
335+
336+
self
337+
assert:
338+
(df
339+
removeRowsWhereElementsInColumnAt: 3
340+
satisfy: [ :ele | ele isNil ])
341+
equals: expected
341342
]
342343

343344
{ #category : #tests }

src/DataFrame-Tests/DataFrameTest.class.st

+33-33
Original file line numberDiff line numberDiff line change
@@ -4016,60 +4016,60 @@ DataFrameTest >> testRemoveRowsAt [
40164016
]
40174017

40184018
{ #category : #removing }
4019-
DataFrameTest >> testRemoveRowsOfColumnElementsSatisfingOnColumnAllTrue [
4019+
DataFrameTest >> testRemoveRowsWhereElementsInColumnAtSatisfy [
40204020

40214021
| expected aBlock |
4022+
df := DataFrame withRows:
4023+
#( #( 1 2 3 ) #( Dubai 4 5.0 ) #( nil 8.788 false ) ).
40224024

4023-
expected := DataFrame withColumns: #().
4024-
aBlock := [ :rowElement | true ].
4025-
4026-
self assert: (df removeRowsOfColumnElementsSatisfying: aBlock onColumn: 2) equals: expected
4027-
]
4025+
df rowNames: #( A B C ).
4026+
df columnNames: #( X Y Z ).
40284027

4029-
{ #category : #removing }
4030-
DataFrameTest >> testRemoveRowsOfColumnElementsSatisfingOnColumnNamed [
4028+
expected := DataFrame withRows: #( #( Dubai 4 5.0 ) ).
40314029

4032-
| expected aBlock |
4033-
df := DataFrame withRows: #(
4034-
(1 2 3)
4035-
(Dubai 4 5.0)
4036-
(nil 8.788 false)).
4030+
expected rowNames: #( B ).
4031+
expected columnNames: #( X Y Z ).
40374032

4038-
df rowNames: #(A B C).
4039-
df columnNames: #(X Y Z).
4033+
aBlock := [ :rowElement | rowElement ~= 4 ].
40404034

4041-
expected := DataFrame withRows: #(
4042-
(Dubai 4 5.0)).
4035+
self
4036+
assert: (df removeRowsWhereElementsInColumnAt: 2 satisfy: aBlock)
4037+
equals: expected
4038+
]
40434039

4044-
expected rowNames: #(B).
4045-
expected columnNames: #(X Y Z).
4040+
{ #category : #removing }
4041+
DataFrameTest >> testRemoveRowsWhereElementsInColumnAtSatisfyAllTrue [
40464042

4047-
aBlock := [ :rowElement | rowElement ~= 4 ].
4043+
| expected aBlock |
4044+
expected := DataFrame withColumns: #( ).
4045+
aBlock := [ :rowElement | true ].
40484046

4049-
self assert: (df removeRowsOfColumnElementsSatisfing: aBlock onColumnNamed: #Y) equals: expected
4047+
self
4048+
assert: (df removeRowsWhereElementsInColumnAt: 2 satisfy: aBlock)
4049+
equals: expected
40504050
]
40514051

40524052
{ #category : #removing }
4053-
DataFrameTest >> testRemoveRowsOfColumnElementsSatisfyingOnColumn [
4053+
DataFrameTest >> testRemoveRowsWhereElementsInColumnNamedSatisfy [
40544054

40554055
| expected aBlock |
4056-
df := DataFrame withRows: #(
4057-
(1 2 3)
4058-
(Dubai 4 5.0)
4059-
(nil 8.788 false)).
4056+
df := DataFrame withRows:
4057+
#( #( 1 2 3 ) #( Dubai 4 5.0 ) #( nil 8.788 false ) ).
40604058

4061-
df rowNames: #(A B C).
4062-
df columnNames: #(X Y Z).
4059+
df rowNames: #( A B C ).
4060+
df columnNames: #( X Y Z ).
40634061

4064-
expected := DataFrame withRows: #(
4065-
(Dubai 4 5.0)).
4062+
expected := DataFrame withRows: #( #( Dubai 4 5.0 ) ).
40664063

4067-
expected rowNames: #(B).
4068-
expected columnNames: #(X Y Z).
4064+
expected rowNames: #( B ).
4065+
expected columnNames: #( X Y Z ).
40694066

40704067
aBlock := [ :rowElement | rowElement ~= 4 ].
40714068

4072-
self assert: (df removeRowsOfColumnElementsSatisfying: aBlock onColumn: 2) equals: expected
4069+
self
4070+
assert:
4071+
(df removeRowsWhereElementsInColumnNamed: #Y satisfy: aBlock)
4072+
equals: expected
40734073
]
40744074

40754075
{ #category : #removing }

src/DataFrame/Array.extension.st

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Extension { #name : 'Array' }
1+
Extension { #name : #Array }
22

3-
{ #category : '*DataFrame' }
3+
{ #category : #'*DataFrame' }
44
Array >> calculateDataType [
55

66
| types |
@@ -18,7 +18,7 @@ Array >> calculateDataType [
1818
^ UndefinedObject
1919
]
2020

21-
{ #category : '*DataFrame' }
21+
{ #category : #'*DataFrame' }
2222
Array >> leastCommonSuperclassOf: firstClass and: secondClass [
2323
"Determines the closest element of class hierarchy which is the common ancestor of two given classes"
2424

@@ -40,7 +40,7 @@ Array >> leastCommonSuperclassOf: firstClass and: secondClass [
4040
^ Object
4141
]
4242

43-
{ #category : '*DataFrame' }
43+
{ #category : #'*DataFrame' }
4444
Array >> sortIfPossible [
4545
"Sort if possible"
4646

src/DataFrame/Behavior.extension.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Extension { #name : 'Behavior' }
1+
Extension { #name : #Behavior }
22

3-
{ #category : '*DataFrame-Core-Base' }
3+
{ #category : #'*DataFrame-Core-Base' }
44
Behavior >> inheritsFromOrEqualTo: aClass [
55
"Answer whether the argument, aClass, is equal to the receiver or belongs to its superclass chain."
66

src/DataFrame/Collection.extension.st

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Extension { #name : 'Collection' }
1+
Extension { #name : #Collection }
22

3-
{ #category : '*DataFrame-Core-Base' }
3+
{ #category : #'*DataFrame-Core-Base' }
44
Collection >> ** arg [
55

66
^ self raisedTo: arg
77
]
88

9-
{ #category : '*DataFrame' }
9+
{ #category : #'*DataFrame' }
1010
Collection >> asDataFrame [
1111

1212
| numberOfRows numberOfColumns dataFrame |
@@ -31,26 +31,26 @@ Collection >> asDataFrame [
3131
^ dataFrame
3232
]
3333

34-
{ #category : '*DataFrame-Core-Base' }
34+
{ #category : #'*DataFrame-Core-Base' }
3535
Collection >> asDataSeries [
3636

3737
^ DataSeries newFrom: self
3838
]
3939

40-
{ #category : '*DataFrame-Core-Base' }
40+
{ #category : #'*DataFrame-Core-Base' }
4141
Collection >> closeTo: aCollection [
4242

4343
^ (self - aCollection) inject: true into: [ :accum :each |
4444
accum and: (each closeTo: 0) ]
4545
]
4646

47-
{ #category : '*DataFrame-Core-Base' }
47+
{ #category : #'*DataFrame-Core-Base' }
4848
Collection >> variance [
4949

5050
^ self stdev squared
5151
]
5252

53-
{ #category : '*DataFrame' }
53+
{ #category : #'*DataFrame' }
5454
Collection >> withSeries: aDataSeries collect: twoArgBlock [
5555
"Collect and return the result of evaluating twoArgBlock with corresponding elements from this collection and aDataSeries."
5656
| result |

src/DataFrame/DataCorrelationMethod.class.st

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
Class {
2-
#name : 'DataCorrelationMethod',
3-
#superclass : 'Object',
4-
#category : 'DataFrame-Math',
5-
#package : 'DataFrame',
6-
#tag : 'Math'
2+
#name : #DataCorrelationMethod,
3+
#superclass : #Object,
4+
#category : 'DataFrame-Math'
75
}
86

9-
{ #category : 'comparing' }
7+
{ #category : #comparing }
108
DataCorrelationMethod class >> between: x and: y [
119
"Calcualte the correlation coefficient between two data series"
1210
self subclassResponsibility

0 commit comments

Comments
 (0)