/
plot_benchmark_results_line_chart.py
executable file
·64 lines (49 loc) · 1.27 KB
/
plot_benchmark_results_line_chart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
#
# (C) Copyright 2021 Pavel Tisnovsky
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Pavel Tisnovsky
#
import sys
import matplotlib.pyplot as plt
import pandas as pd
# Check if command line argument is specified (it is mandatory).
if len(sys.argv) < 2:
print("Usage:")
print(" plot_benchmark_results_line_chart.py ")
print("Example:")
print(" plot_benchmark_results_line_chart.py data.tsv")
sys.exit(1)
# First command line argument should contain name of input CSV.
input_file = sys.argv[1]
df = pd.read_csv(input_file, sep="\t")
data_columns = [
"ANSI C",
"Cython #1",
"Cython #2",
"Cython #3",
"Numba #1/interpret",
"Numba #2",
"Numba #3",
"Numba #4",
]
for data_column in data_columns:
df[data_column] = pd.to_numeric(
df[data_column].str.replace(",", "."), errors="coerce"
)
print(df)
print()
print(df.info())
print()
print(df.describe())
print()
# Create new histogram graph
df.plot(x="Height", y=data_columns)
# Try to show the plot on screen
plt.show()