-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadData.py
More file actions
68 lines (53 loc) · 1.55 KB
/
Copy pathreadData.py
File metadata and controls
68 lines (53 loc) · 1.55 KB
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
65
66
67
import csv
from cProfile import label
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
docID = []
entityID = []
conf_entity = []
with open("documents_entities.csv", 'r') as csvfi:
read = csv.reader(csvfi, delimiter=',')
next(read)
for row in read:
docID.append(int(row[0]))
entityID.append(row[1])
conf_entity.append(float(row[2]))
'''plt.scatter(docID, conf_entity, color='g')
plt.xlabel('Document ID')
plt.ylabel('Confidence Level')
plt.legend()
plt.title("Document entities Plot")
#plt.show()'''
categoryID =[]
conf_cat=[]
with open('documents_categories.csv', 'r') as file:
f = csv.reader(file, delimiter=',')
next(f)
for row in f:
categoryID.append(int(row[1]))
conf_cat.append(float(row[2]))
'''plt.scatter(categoryID, conf_cat, color='c')
plt.xlabel('Category ID')
plt.ylabel('Confidence Level')
plt.legend()
plt.title("Document Category Plot")
#plt.show()'''
docID = []
topicID = []
conf_topic = []
with open("documents_topics.csv", 'r') as tfile:
q = csv.reader(tfile, delimiter=',')
next(q)
for row in q:
topicID.append(row[1])
conf_topic.append(float(row[2]))
'''plt.scatter(topicID, conf_topic, color='g')
plt.xlabel('Topic ID')
plt.ylabel('Confidence Level')
plt.legend()
plt.title("Document Topic Plot")
#plt.show()'''
dict_data = dict(document_id=docID,entity_id=entityID,topic_id=topicID,category_id=categoryID,confidence_level=conf_entity)
document_frame = pd.DataFrame({k : pd.Series(v) for k,v in dict_data.iteritems()})
print document_frame