Skip to content

Commit 4a3fb4c

Browse files
Added DataFrame>> #includesAny: with tests.
1 parent 67c6717 commit 4a3fb4c

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

src/DataFrame-Tests/DataFrameTest.class.st

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,6 +1973,25 @@ DataFrameTest >> testIncludesAll [
19731973
dataSeries2 })
19741974
]
19751975

1976+
{ #category : #'find-select' }
1977+
DataFrameTest >> testIncludesAny [
1978+
1979+
| dataSeries1 dataSeries2 |
1980+
dataSeries1 := DataSeries
1981+
withKeys: #( City Population BeenThere )
1982+
values: #( London 8.788 false )
1983+
name: 'C'.
1984+
dataSeries2 := DataSeries
1985+
withKeys: #( City Population BeenThere )
1986+
values: #( Paris 8.788 false )
1987+
name: 'B'.
1988+
1989+
self assert: (df includesAny: {
1990+
dataSeries1.
1991+
dataSeries2 }).
1992+
self deny: (df includesAny: { dataSeries2 })
1993+
]
1994+
19761995
{ #category : #tests }
19771996
DataFrameTest >> testIndexOfColumnNamed [
19781997
| expected actual |

src/DataFrame/DataFrame.class.st

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,14 @@ DataFrame >> includesAll: aDataSeriesCollection [
12581258
self includes: dataSeries ]
12591259
]
12601260

1261+
{ #category : #'find-select' }
1262+
DataFrame >> includesAny: aDataSeriesCollection [
1263+
"Returns true if the DataFrame includes any of the DataSeries in the specified collection."
1264+
1265+
^ aDataSeriesCollection anySatisfy: [ :dataSeries |
1266+
self includes: dataSeries ]
1267+
]
1268+
12611269
{ #category : #accessing }
12621270
DataFrame >> indexOfColumnNamed: columnName [
12631271
"Answer the index of a column with a given name or signal an exception if the column with that name was not found"

0 commit comments

Comments
 (0)