Add drop_na() method to Series class - #668
Closed
niatimary wants to merge 1 commit into
Closed
Conversation
CommonClimate
requested changes
Aug 26, 2025
CommonClimate
left a comment
Collaborator
There was a problem hiding this comment.
Please:
- rename to
dropna() - reuse
tsbase.dropna()(see init_ for an example of how this is one) - this seems overkill:
time = ts_clean.__dict__["time"]
value = ts_clean.__dict__["value"]
you should be able to access them by ts_clean.time and ts_clean.value. AI coding is not always best...
CommonClimate
left a comment
Collaborator
There was a problem hiding this comment.
You can simply re-use this bit:
if dropna == True:
value, time = tsbase.dropna(value, time, verbose=verbose)
if keep_log == True:
if len(self.log) > 0:
if self.log[0][0] == 'dropna' and self.log[0]['applied'] == True:
pass # no need to clog the log with redundant information
elif self.log[0][0] == 'clean_ts' and self.log[0]['applied']==True:
self.log[0]['legacy']=True
self.log += ({len(self.log): 'dropna', 'applied': dropna, 'verbose': verbose},)
else:
self.log += ({len(self.log): 'dropna', 'applied': dropna, 'verbose': verbose},)
elif dropna == False:
pass
else:
raise ValueError('dropna should be a boolean')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Series.drop_na()method to remove NaN values while preserving temporal order, complementing the existingSeries.clean()method which removes NaNs and sorts data.TestUISeriesClean.test_drop_na()inpyleoclim/tests/test_core_Series.py