h2oai / h2oai/datatable

[BUG] replace does not work on date columns

Open
#3,172 1 comment 0 reactions 1 assignee Claimed by @pradkrish View on GitHub
bug
Dominant language
C++
Stars
1.9k
Forks
164
Avg merge
7h 31m
Merged PRs (30d)
1

Description

- Did you find a bug in datatable, or maybe the bug found you?
The replace function does not work on date columns; no change is effected.

- How to reproduce the bug?
```py
source = {"dates" : [date(2000, 1, 5), date(2010, 11, 23), date(2020, 2, 29), None],
"integers" : range(1, 5),
"floats" : [10.0, 11.5, 12.3, -13],
"strings" : ['A', 'B', None, 'D']
}
DT = dt.Frame(source)

DT
| dates integers floats strings
| date32 int32 float64 str32
-- + ---------- -------- ------- -------
0 | 2000-01-05 1 10 A
1 | 2010-11-23 2 11.5 B
2 | 2020-02-29 3 12.3 NA
3 | NA 4 -13 D
[4 rows x 4 columns]

DT.replace(date(2000, 1, 5), date(2999, 12, 31))

DT
| dates integers floats strings
| date32 int32 float64 str32
-- + ---------- -------- ------- -------
0 | 2000-01-05 1 10 A # the date does not change
1 | 2010-11-23 2 11.5 B
2 | 2020-02-29 3 12.3 NA
3 | NA 4 -13 D
```

- What was the expected behavior?
```py
DT
| dates integers floats strings
| date32 int32 float64 str32
-- + ---------- -------- ------- -------
0 | 2999-12-31 1 10 A # expected change
1 | 2010-11-23 2 11.5 B
2 | 2020-02-29 3 12.3 NA
3 | NA 4 -13 D
```

- Your environment?
datatable version 1.1
python version 3.9
Linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.