danfojs
danfojs copied to clipboard
559 replace does not accept falsy strings or numbers
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). - Updated unit tests for
Series.replace(). - Updated unit tests for
DataFrame.replace().
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 ✌