mirror of
https://github.com/hohn/sarif-cli.git
synced 2025-12-16 09:13:04 +01:00
fix: only concatenate non-empty tables to suppress float conversion
This commit is contained in:
committed by
=Michael Hohn
parent
82a8e7a6dc
commit
32413984e2
@@ -44,11 +44,16 @@ def joins_for_results(basetables, external_info):
|
||||
Form and return the `results` table
|
||||
"""
|
||||
# Get one table per result_type, then stack them,
|
||||
# (kind_problem,
|
||||
# kind_pathproblem,
|
||||
# )
|
||||
return pd.concat([_results_from_kind_problem(basetables, external_info),
|
||||
_results_from_kind_pathproblem(basetables, external_info)])
|
||||
# kind_problem
|
||||
# kind_pathproblem
|
||||
#
|
||||
# Concatenation with an empty table triggers type conversion to float, so don't
|
||||
# include empty tables
|
||||
res = pd.concat(
|
||||
[table for table in [_results_from_kind_problem(basetables, external_info),
|
||||
_results_from_kind_pathproblem(basetables, external_info)]
|
||||
if len(table) > 0])
|
||||
return res
|
||||
|
||||
def _results_from_kind_problem(basetables, external_info):
|
||||
b = basetables; e = external_info
|
||||
@@ -83,6 +88,7 @@ def _results_from_kind_problem(basetables, external_info):
|
||||
})
|
||||
# Force column type(s) to avoid floats in output.
|
||||
res1 = res.astype({ 'id' : 'uint64', 'scan_id': 'uint64'}).reset_index(drop=True)
|
||||
|
||||
return res1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user