559 replace does not accept falsy strings or numbers#562
Merged
risenW merged 4 commits intojavascriptdata:devfrom Apr 2, 2025
Merged
Conversation
…or when oldValue is NaN
…ers (0), falsy strings (''), and throw when oldValue is NaN.
|
Hi, I've been checking a bit the pull request and it seems that there is a failure in the treatment of dates, this is the code that fails and what it expects, I don't know if it is due to the changes in the pull request or other changes. Code: test('DataFrame Dates', () => {
let data = [
['Alice', 2, new Date('2029-01-01 01:00:00')],
['Bob', 5, new Date('2019-01-02')],
['Charlie', 30, new Date('2020-01-03 01:00:20')],
['Dennis', 89, new Date('2022-02-04 02:16:00')]
]
let columns = ["Name", "Count", "Date"];
let df = new dfd.DataFrame(data, { columns: columns });
expect(df["Date"].dt.hours().values).toStrictEqual([1, 0, 1, 2]);
})Error: Error: expect(received).toStrictEqual(expected) // deep equality
- Expected - 1
+ Received + 1
Array [
1,
- 0,
+ 1,
1,
2,
]Regards ✌ |
risenW
approved these changes
Jul 16, 2023
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.
Overview
Fix for Issue #559 .
Series.replace()accepts 0 and '' for botholdValueandnewValue.Series.replace()accepts NaN fornewValue.Series.replace() throws ifoldValueis NaN (notifies user thatSeries.fillNa()should be used instead).DataFrame.replace()accepts 0 and '' for botholdValueandnewValue.DataFrame.replace()accepts NaN fornewValue.DataFrame.replace() throws ifoldValueis NaN (notifies user thatDataFrame.fillNa()should be used instead).Series.replace().DataFrame.replace().