Skip to content

Commit 2175378

Browse files
authored
Merge pull request #245 from Joshua-Dias-Barreto/Readme
Added a DataFrame>> #rows and tests. Fixes #244
2 parents dae58a9 + 7bf6399 commit 2175378

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/DataFrame-Tests/DataFrameTest.class.st

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4927,6 +4927,18 @@ DataFrameTest >> testRowsFromToPut [
49274927
self assert: dataFrame equals: expected
49284928
]
49294929

4930+
{ #category : #tests }
4931+
DataFrameTest >> testRowsMethod [
4932+
4933+
| expectedCollection |
4934+
expectedCollection := {
4935+
(df rowAt: 1).
4936+
(df rowAt: 2).
4937+
(df rowAt: 3) } asArray.
4938+
4939+
self assert: df rows equals: expectedCollection
4940+
]
4941+
49304942
{ #category : #tests }
49314943
DataFrameTest >> testRowsPut [
49324944
| rowNames columnNames dataFrame newRows expected |

src/DataFrame/DataFrame.class.st

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,13 @@ DataFrame >> rowNames: anArray [
20522052
self privateRowNames: anArray
20532053
]
20542054

2055+
{ #category : #accessing }
2056+
DataFrame >> rows [
2057+
"Returns a collection of all rows"
2058+
2059+
^ (1 to: self numberOfRows) collect: [ :j | self rowAt: j ]
2060+
]
2061+
20552062
{ #category : #accessing }
20562063
DataFrame >> rows: anArrayOfNames [
20572064
"Returns a collection of rows whose row names are present in the array anArrayOfNames"

0 commit comments

Comments
 (0)