I am upgrading from Data::Table v1.54 to v1.63 and I am seeing a new
behavior in the pivot action.
In v1.54, if I pivot a numeric column and have an undefined value, the
new table would also have an undefiend value. However, in v1.63 the
undefined value is now set to 0 (zero). This can and has caused some
issues in my scripts since I expect the undefined value and testing
against zero can lead to unintended behavior.
Full Disclosure on Server Differences:
v1.63 server runs Perl v5.12.2 on Linux 2.6.18-194.e15
V1.54 server runs Perl v5.8.8 on Linux 2.6.18-194.3.1.e15
I did not see the behavior change until I updated from Data::Table
v1.54 to v1.63 on the first server.
Here is a small example to highlight the issue.
Original Table ($t)
Site Month Cost
A M201201 0.85
A M201202 0.50
B M201201 0.75
C M201202 0.60
Now the pivot action
my $t_pivot = $t->pivot("Month",0,"Cost",["Site"]);
In v1.54, $t_pivot is
Site M201201 M201202
A 0.85 0.50
B 0.75 (null)
C (null) 0.60
In v1.63, $t_pivot is
Site M201201 M201202
A 0.85 0.50
B 0.75 0.00
C 0.00 0.60
I am hoping there is an option that I am overlooking in pivot that
addresses this behavior. If not, can you provide an option to retain
undefined values if the pivoting column is a numeric?
I love this module and use it quite heavily, so thank you for your work
so far and your future updates!