Skip to content

Commit

Permalink
Merge pull request #2841 from martinholmer/fix-tc-csv-weights
Browse files Browse the repository at this point in the history
Fix weights precision in CLI tool default micro output file
  • Loading branch information
martinholmer authored Nov 18, 2024
2 parents b3bca61 + 8542516 commit ed27836
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions taxcalc/taxcalcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,18 @@ def write_output_file(self, output_dump, dump_varset,
assert 'RECID' in column_order, 'RECID not in dump output list'
column_order.remove('RECID')
column_order.insert(0, 'RECID')
weight_vname = 's006'
else:
outdf = self.minimal_output()
column_order = outdf.columns
weight_vname = 'WEIGHT'
assert len(outdf.index) == self.calc.array_len
if self.tmd_input_data: # pragma: no cover
if "s006" in outdf:
weights = outdf["s006"].round(5)
if weight_vname in outdf:
weights = outdf[weight_vname].round(5)
outdf = outdf.round(2)
if "s006" in outdf:
outdf["s006"] = weights
if weight_vname in outdf:
outdf[weight_vname] = weights
outdf.to_csv(self._output_filename, columns=column_order,
index=False)
else:
Expand Down

0 comments on commit ed27836

Please sign in to comment.