Skip to content

Commit 19ff9ca

Browse files
author
roxx30198
committed
Fix dataframe warning caused by type cast
1 parent c90eb86 commit 19ff9ca

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

dpbench/infrastructure/reporter.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,24 @@ def generate_performance_report(
199199
.where(dm.Result.run_id == run_id)
200200
)
201201

202-
df = pd.read_sql_query(
203-
sql=sql,
204-
con=conn.connect(),
202+
df = (
203+
pd.read_sql_query(sql=sql, con=conn.connect())
204+
.astype({impl: "string" for impl in implementations})
205+
.fillna("n/a")
205206
)
206207

207208
for index, row in df.iterrows():
208209
for impl in implementations:
209210
time = row[impl]
210-
if time:
211-
NANOSECONDS_IN_MILISECONDS: Final[float] = 1000 * 1000.0
212-
time /= NANOSECONDS_IN_MILISECONDS
213211

214-
time = str(round(time, 2)) + "ms"
215-
else:
216-
time = "n/a"
212+
if time == "n/a":
213+
pass
214+
215+
NANOSECONDS_IN_MILISECONDS: Final[float] = 1000 * 1000.0
216+
time = float(time)
217+
time /= NANOSECONDS_IN_MILISECONDS
218+
219+
time = str(round(time, 2)) + "ms"
217220

218221
df.at[index, impl] = time
219222

0 commit comments

Comments
 (0)