@@ -219,7 +219,7 @@ def databaseCreation(nameDatabase):
219219 cursor = database .cursor ()
220220 request = "DROP TABLE IF EXISTS Lots"
221221 sql = cursor .execute (request )
222- request = "CREATE TABLE Lots(lotId INTEGER,tedCanId INTEGER,correctionsNB INTEGER,cancelled INTEGER,awardDate TEXT,awardEstimatedPrice NUMERIC,awardPrice NUMERIC,cpv TEXT,tenderNumber INTEGER,onBehalf TINYINT,jointProcurement TINYINT,fraAgreement TINYINT,fraEstimated INTEGER ,lotsNumber INTEGER,accelerated TINYINT,outOfDirectives TINYINT,contractorSme TINYINT,numberTendersSme INTEGER,subContracted TINYINT,gpa TINYINT,multipleCae TINYINT,typeOfContract TEXT,topType TEXT,renewal TINYINT, contractDuration INTEGER , publicityDuration INTEGER ,PRIMARY KEY(lotId))"
222+ request = "CREATE TABLE Lots(lotId INTEGER,tedCanId INTEGER,correctionsNB INTEGER,cancelled INTEGER,awardDate TEXT,awardEstimatedPrice NUMERIC,awardPrice NUMERIC,cpv TEXT,tenderNumber INTEGER,onBehalf TINYINT,jointProcurement TINYINT,fraAgreement TINYINT,fraEstimated TEXT ,lotsNumber INTEGER,accelerated TINYINT,outOfDirectives TINYINT,contractorSme TINYINT,numberTendersSme INTEGER,subContracted TINYINT,gpa TINYINT,multipleCae TINYINT,typeOfContract TEXT,topType TEXT,renewal TINYINT, contractDuration NUMERIC , publicityDuration NUMERIC ,PRIMARY KEY(lotId))"
223223 sql = cursor .execute (request )
224224 request = "DROP TABLE IF EXISTS AgentsBase"
225225 sql = cursor .execute (request )
@@ -275,6 +275,26 @@ def firstCleaning(datas,database):
275275
276276 # Parenthesis deletion
277277 datas ["CAE_NAME" ] = datas ["CAE_NAME" ].replace (regex = r'\([^)]*\)' ,value = r"" )
278+
279+ # Replace "Y" by 1 and "N" by 0 on boolean columns
280+ datas ["B_ON_BEHALF" ] = datas ["B_ON_BEHALF" ].replace (regex = r'Y' ,value = r"1" )
281+ datas ["B_ON_BEHALF" ] = datas ["B_ON_BEHALF" ].replace (regex = r'N' ,value = r"0" )
282+ datas ["B_INVOLVES_JOINT_PROCUREMENT" ] = datas ["B_INVOLVES_JOINT_PROCUREMENT" ].replace (regex = r'Y' ,value = r"1" )
283+ datas ["B_INVOLVES_JOINT_PROCUREMENT" ] = datas ["B_INVOLVES_JOINT_PROCUREMENT" ].replace (regex = r'N' ,value = r"0" )
284+ datas ["B_FRA_AGREEMENT" ] = datas ["B_FRA_AGREEMENT" ].replace (regex = r'Y' ,value = r"1" )
285+ datas ["B_FRA_AGREEMENT" ] = datas ["B_FRA_AGREEMENT" ].replace (regex = r'N' ,value = r"0" )
286+ datas ["B_ACCELERATED" ] = datas ["B_ACCELERATED" ].replace (regex = r'Y' ,value = r"1" )
287+ datas ["B_ACCELERATED" ] = datas ["B_ACCELERATED" ].replace (regex = r'N' ,value = r"0" )
288+ datas ["B_OUT_OF_DIRECTIVES" ] = datas ["B_OUT_OF_DIRECTIVES" ].replace (regex = r'Y' ,value = r"1" )
289+ datas ["B_OUT_OF_DIRECTIVES" ] = datas ["B_OUT_OF_DIRECTIVES" ].replace (regex = r'N' ,value = r"0" )
290+ datas ["B_CONTRACTOR_SME" ] = datas ["B_CONTRACTOR_SME" ].replace (regex = r'Y' ,value = r"1" )
291+ datas ["B_CONTRACTOR_SME" ] = datas ["B_CONTRACTOR_SME" ].replace (regex = r'N' ,value = r"0" )
292+ datas ["B_SUBCONTRACTED" ] = datas ["B_SUBCONTRACTED" ].replace (regex = r'Y' ,value = r"1" )
293+ datas ["B_SUBCONTRACTED" ] = datas ["B_SUBCONTRACTED" ].replace (regex = r'N' ,value = r"0" )
294+ datas ["B_GPA" ] = datas ["B_GPA" ].replace (regex = r'Y' ,value = r"1" )
295+ datas ["B_GPA" ] = datas ["B_GPA" ].replace (regex = r'N' ,value = r"0" )
296+ datas ["B_MULTIPLE_CAE" ] = datas ["B_MULTIPLE_CAE" ].replace (regex = r'Y' ,value = r"1" )
297+ datas ["B_MULTIPLE_CAE" ] = datas ["B_MULTIPLE_CAE" ].replace (regex = r'N' ,value = r"0" )
278298
279299 nameCAE = np .array (datas ["CAE_NAME" ])
280300 siretCAE = np .array (datas ["CAE_NATIONALID" ])
0 commit comments