[BUG] replace does not work on date columns

Open
#3,172 1 comment 0 reactions 1 assignee View on GitHub

@pradkrish is already working on this.

Since Oct 13, 2021.

Assessment

This issue has not been assessed yet.

Description

bug
  • 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?

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?
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
Dominant language
C++
Stars
1.9k
Forks
164
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from h2oai/datatable

All issues in h2oai/datatable

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.