-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtTest.py
More file actions
35 lines (26 loc) · 862 Bytes
/
tTest.py
File metadata and controls
35 lines (26 loc) · 862 Bytes
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
import xml.etree.ElementTree as ET
import argparse
import statistics
import pandas as pd
from scipy.stats import ttest_ind
parser = argparse.ArgumentParser(
prog='tripinfo statistic calculator',
description='tripinfo statistic calculator')
parser.add_argument('fileone')
parser.add_argument('filetwo')
args = parser.parse_args()
tree = ET.parse(args.fileone)
root = tree.getroot()
tree2 = ET.parse(args.filetwo)
root2 = tree2.getroot()
durations = []
durations2 = []
for tripinfo in root.findall('tripinfo'):
duration = float(tripinfo.get('duration'))
durations.append(duration)
for tripinfo in root2.findall('tripinfo'):
duration = float(tripinfo.get('duration'))
durations2.append(duration)
t_stat, p_value = ttest_ind(durations,durations2, equal_var=False)
print(f"t-statistic: {t_stat}")
print(f"p-value: {p_value}")