Skip to content

Added DataSeries fillNilsWith method#103

Merged
olekscode merged 1 commit intoPolyMathOrg:masterfrom
AtharvaKhare:fill_nils
Jul 11, 2019
Merged

Added DataSeries fillNilsWith method#103
olekscode merged 1 commit intoPolyMathOrg:masterfrom
AtharvaKhare:fill_nils

Conversation

@AtharvaKhare
Copy link
Contributor

TODO: Add methods for filling with Mean, Mode and Median. This is dependent upon the PR #102, since it will make the code shorter.

@olekscode
Copy link
Member

DataSeries >> fillNilsWith: anObject [
	"Fills nils inplace with anObject"

 	self withIndexDo: [ :ele :index |
		ele isNil
			ifTrue: [ self atIndex: index put: anObject ]
			ifFalse: [ self atIndex: index put: ele ] ]

ifFalse: part is not needed. But it takes time.
Remove it:

DataSeries >> fillNilsWith: anObject [
	"Fills nils inplace with anObject"

 	self withIndexDo: [ :ele :index |
		ele isNil
			ifTrue: [ self atIndex: index put: anObject ] ]

Also added relevant tests
@olekscode olekscode merged commit ffbd70b into PolyMathOrg:master Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants