Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change DataSeries>>#summary a bit #281

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/DataFrame-Tests/DataSeriesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2295,8 +2295,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
14 changes: 9 additions & 5 deletions src/DataFrame/DataSeries.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1055,18 +1055,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
Loading