FillNull

Overview #

The FillNull value is another method of cleaning data. We do not drop row with null value, rather we fill null value with the new value.

->pipe(new FillNull(array(
    "newValue"=>0
)))

Above code will fill all the null value with 10.

Targeted value #

What if you want to target at 0 value, you can do:"

->pipe(new FillNull(array(
    "targetValue"=>0,
    "newValue"=>10,
)))

Fill missing value with MEDIAN and MEAN #

In above example, we fill missing value with the value we want. However the better method is to fill them with mean or median of the column values. This solution seems more elegant. You can do:

->pipe(new FillNull(array(
    "newValue"=>FillNull::MEAN,
)))

For median, you do

->pipe(new FillNull(array(
    "newValue"=>FillNull::MEDIAN,
)))

Target some specific columns #

You can apply fulling action to some of specified columns:

->pipe(new FillNull(array(
    "targetColumns"=>array("salary","tax"),
)))

Exclude some columns #

Some columns are not important and missing value does not affect, you can do:

->pipe(new FillNull(array(
    "excludedColumns"=>array("lastname","gender"),
)))

Target some specific column type #

If you want you can apply the the fill to certain number columns:

->pipe(new FillNull(array(
    "targetColumnType"=>"number"
)))

Strictly Null #

By default the the null could be empty string or 0 value. To enable strict comparison of both value and type, you set the following:

->pipe(new FillNull(array(
    "strict"=>true,
)))

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.