Skip to content

Commit

Permalink
Fix dataframe warning caused by type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
roxx30198 committed Nov 1, 2023
1 parent c90eb86 commit 19ff9ca
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions dpbench/infrastructure/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,24 @@ def generate_performance_report(
.where(dm.Result.run_id == run_id)
)

df = pd.read_sql_query(
sql=sql,
con=conn.connect(),
df = (
pd.read_sql_query(sql=sql, con=conn.connect())
.astype({impl: "string" for impl in implementations})
.fillna("n/a")
)

for index, row in df.iterrows():
for impl in implementations:
time = row[impl]
if time:
NANOSECONDS_IN_MILISECONDS: Final[float] = 1000 * 1000.0
time /= NANOSECONDS_IN_MILISECONDS

time = str(round(time, 2)) + "ms"
else:
time = "n/a"
if time == "n/a":
pass

NANOSECONDS_IN_MILISECONDS: Final[float] = 1000 * 1000.0
time = float(time)
time /= NANOSECONDS_IN_MILISECONDS

time = str(round(time, 2)) + "ms"

df.at[index, impl] = time

Expand Down

0 comments on commit 19ff9ca

Please sign in to comment.