-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.py
61 lines (48 loc) · 1.7 KB
/
tests.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
#!/usr/bin/env python3
import csv
import os
import pandas as pd
import re
import time
from pprint import pprint
import subprocess
from common import zendesk, cufs
from midas import ZENDESK_EXCLUDED_GROUPS
data_sources = '/home/asartori/Dropbox/Midas-wd'
#data_sources = 'L:\OSC\DataSources\ZendeskExports'
zd_file = 'export-2018-11-26-1308-234063-36000022879338d5.csv'
# zd_file = 'test_10000_lines.csv'
#zd_file = 'cropping_test.csv'
# cufs_export_type = 'RCUK'
# paymentsfile = 'VEJJ/VEJJ_2017-10-31.csv'
zenexport = os.path.join(data_sources, zd_file)
# parse_zd_fieldnames(zenexport)
# raise
# # CSV VERSUS PANDAS
# with open(zenexport, encoding="utf-8") as csvfile:
# data = []
# reader = csv.DictReader(csvfile)
# for row in reader:
# data.append(row)
# print('csv.DictReader finished after {} seconds'.format(time.time() - start_time))
# start_time = time.time()
df = pd.read_csv(zenexport)
# data = df.values
pprint(df)
print('Pandas finished after {} seconds'.format(time.time() - start_time))
# TEST FUNCTION output_pruned_zendesk_export
#zendesk.output_pruned_zendesk_export(zenexport, 'cropping_test.csv', **{'Group':ZENDESK_EXCLUDED_GROUPS})
# TEST ZENDESK PARSER
# a = zendesk.Parser()
# a.index_zd_data(zenexport)
# with_title_counter = 0
# without_title_counter = 0
# for k, v in a.zd_dict.items():
# if v.metadata['Manuscript title [txt]'] not in ['', '-']:
# with_title_counter += 1
# else:
# without_title_counter +=1
# print('Total with title: {}'.format(with_title_counter))
# print('Total without title: {}'.format(without_title_counter))
#a.plug_in_payment_data(cufs_export_type, paymentsfile)
print('Finished after {} seconds'.format(time.time() - start_time))