-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMatchID_fast.py
More file actions
59 lines (50 loc) · 1.12 KB
/
Copy pathMatchID_fast.py
File metadata and controls
59 lines (50 loc) · 1.12 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
import os
import re
import pandas as pd
LS = pd.read_csv('Metadata_LS.csv', sep=',', index_col=False)
count = 0
Verdict = []
j = 0
a = 0
falseout = 0
Files = []
PathMain = "TextFiles"
print(PathMain)
for (dirpath, dirnames, filenames) in os.walk(PathMain):
Files.extend(filenames)
break
IDs = []
IDsDict = {}
NotFoundID = []
NotFoundFile = []
NewFiles = []
NewFilesDict = {}
for Row in range(len(LS)):
CID = LS.loc[LS.index[Row],'id']
IDs.append(CID)
try:
IDsDict[CID]+= 1
NotFoundID.append(CID)
except KeyError:
IDsDict[CID]=1
print('Number of Files:',len(Files))
print('Number of IDs:',len(IDs))
for File in Files:
FileName = File[:len(File)-4]
NewFiles.append(FileName)
try:
NewFilesDict[FileName]+= 1
NotFoundFile.append(FileName)
except KeyError:
NewFilesDict[FileName]=1
#if FileName not in IDsDict.keys():
# NotFoundFile.append(FileName)
#for ID in IDs:
# if ID not in NewFilesDict.keys():
# NotFoundID.append(ID)
print('Files Checked:',len(NewFiles))
print('IDs Checked:',len(IDs))
print('IDs Not Found:',len(NotFoundID))
print('Files Not Found:',len(NotFoundFile))
print(NotFoundID)
print(NotFoundFile)