h2oai / datatable

A Python package for manipulating 2-dimensional tabular data structures

Home Page:https://datatable.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`coalesce` or fillna across the rows

samukweku opened this issue · comments

  • Fill nulls row wise

Example:

DT
   |    col1     col2     col3     col4
   | float64  float64  float64  float64
-- + -------  -------  -------  -------
 0 |      NA       NA        2       NA
 1 |       2        5       NA       10
 2 |       4        1        9       11
 3 |       5        0        1        4
 4 |      NA       NA       NA        8
[5 rows x 4 columns]


DT[:, f[:].coalesce(reverse=True)]
   |    col1     col2     col3     col4
   | float64  float64  float64  float64
-- + -------  -------  -------  -------
 0 |       2        2        2       NA
 1 |       2        5       10       10
 2 |       4        1        9       11
 3 |       5        0        1        4
 4 |       8        8        8        8
[5 rows x 4 columns]

[5 rows x 5 columns]