Skip to content

Commit ae93064

Browse files
committed
try2reindex
1 parent dcb80b6 commit ae93064

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Class/KnowledgeBase.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import glob
22

33
import pandas as pd
4-
import pandas.DataFrame as df
4+
from pandas import DataFrame
55

66
from Class.Match import Match
77
from Class.Port import Port
@@ -12,7 +12,7 @@ def __init__(self, matchList: [Match] = [Match], outPortList: [Port] = [Port], i
1212
self.matchList = matchList
1313
self.portListDict = {str: [Port]}
1414
self.portDict = {str: Port}
15-
self.dfDict = {str: df} # in,out,match
15+
self.dfDict = {str: DataFrame()} # in,out,match
1616

1717
def learn_folder(self, path2folder='..\excel\learn/220-母线&线路-第一套合并单元&第一套合并单元'):
1818
for filename in glob.iglob(path2folder + '**/*.xls', recursive=True):
@@ -29,9 +29,6 @@ def learn_excel(self, path2excel):
2929
inPort = Port(row[1]['开入端子描述'], row[1]['开入端子引用'])
3030
match = Match(outPort, inPort)
3131
self.matchList.append(match)
32-
df = self.dfDict.get('开出', df)
33-
key = row[1]['开出端子描述'] + row[1]['开出端子引用']
34-
port = df.get(key)
3532
except RuntimeError:
3633
print(row[1])
3734
print(dir(self.matchList))
@@ -46,21 +43,24 @@ def load_excel(self, path2excel='..\excel\learn/220-母线&线路-第一套合
4643
portList.append(port)
4744
key2 = row[1][title + '端子描述'] + title + row[1][title + '端子引用']
4845
self.portDict[key2] = port
49-
df = self.dfDict.get(title, df)
46+
df = self.dfDict.get(title, DataFrame())
47+
df2=DataFrame()
5048
if sheetName == '已配置':
5149
df[key2] = df.get(key2, {object: float})
5250
else: # new
53-
for done in df:
54-
done[key2] = done.get(key2, float) # is autoFill metaData useful?
51+
if key2 not in df.index:
52+
df2.reindex([key2])
53+
print (df2.index[key2])
54+
55+
5556
self.portListDict[key] = portList
5657
except RuntimeError:
5758
print(row[1])
58-
print(dir(portList))
5959

6060

61-
def load_test(self, path2excel='..\excel\learn/220-母线&线路-第一套合并单元&第一套合并单元/赤厝.xls'):
62-
self.load_excel(path2excel, sheetName='所有发送', title='开出')
63-
self.load_excel(path2excel, sheetName='所有接收', title='开入')
61+
def load_test(self, path2excel='..\excel\learn/220-母线&线路-第一套合并单元&第一套合并单元/赤厝.xls'):
62+
self.load_excel(path2excel, sheetName='所有发送', title='开出')
63+
self.load_excel(path2excel, sheetName='所有接收', title='开入')
6464

6565

6666
def transform(multilevelDict):

preRequireInstall.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#pip install -r requirements.txt
2-
sudo pip install jsonpickle tencentcloud-sdk-python scf django-excel xlrd wheel pandas
2+
sudo pip install jsonpickle tencentcloud-sdk-python scf django-excel xlrd wheel pandas kite

0 commit comments

Comments
 (0)