Skip to content

Commit

Permalink
Merge branch 'master' into add_shuffling
Browse files Browse the repository at this point in the history
  • Loading branch information
hernanmd authored Dec 14, 2023
2 parents 4878ce3 + f085adf commit 07d97ca
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/DataFrame-Tests/DataSeriesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2297,8 +2297,8 @@ DataSeriesTest >> testStatsSummary [
| expected actual |

expected := DataSeries
withKeys: #(Min '1st Qu.' Median Average '3rd Qu.' Max)
values: { 3 . 7 . 9 . (115 / 11) . 15 . 20 }
withKeys: #(Count Average Stdev Min '25%' '50%' '75%' Max)
values: { 11 . series values average . series values stdev . 3 . 7 . 9 . 15 . 20 }
name: series name.

actual := series summary.
Expand Down
15 changes: 14 additions & 1 deletion src/DataFrame/DataFrame.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2577,7 +2577,20 @@ DataFrame >> stdev [
^ self applyToAllColumns: #stdev
]

{ #category : 'accessing' }
{ #category : #statistics }
DataFrame >> summary [
| summaryFrame |
summaryFrame := nil.
self columnNames do: [ :column |
((self dataTypeOfColumn: column) inheritsFrom: Number)
ifTrue: [
summaryFrame
ifNil: [ summaryFrame := (self column: column) summary asDataFrame ]
ifNotNil: [ summaryFrame addColumn: (self column: column) summary ] ] ].
^ summaryFrame
]

{ #category : #accessing }
DataFrame >> tail [
"Returns the last 5 rows of a DataFrame"

Expand Down
14 changes: 9 additions & 5 deletions src/DataFrame/DataSeries.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1057,18 +1057,22 @@ DataSeries >> sum [

{ #category : 'statistics' }
DataSeries >> summary [
"A data series is returned which is a statistical summary of the data series. With keys as different statistical measures and values as the values returned when those statistical measures are applied on the data series."
"A data series is returned which is a statistical summary of the data series.
With keys as different statistical measures and values as the values returned
when those statistical measures are applied on the data series."

| summary |
summary := self species new.
summary name: self name.

summary
at: 'Min' put: self min;
at: '1st Qu.' put: self firstQuartile;
at: 'Median' put: self median;
at: 'Count' put: self size;
at: 'Average' put: self average;
at: '3rd Qu.' put: self thirdQuartile;
at: 'Stdev' put: self stdev;
at: 'Min' put: self min;
at: '25%' put: self firstQuartile;
at: '50%' put: self median;
at: '75%' put: self thirdQuartile;
at: 'Max' put: self max.

^ summary
Expand Down

0 comments on commit 07d97ca

Please sign in to comment.