随笔分类 -  语言Python

摘要:import osimport pytzfrom datetime import timedelta, datetimefrom airflow.operators.http_operator import SimpleHttpOperatorfrom airflow.models import D 阅读全文
posted @ 2021-12-03 15:28 石棠 阅读(291) 评论(0) 推荐(0)
摘要:import xlrdfrom DataCleaning.library.functions.changeDirectory import *# read and return .xlfx/.XLFX file with file name: fnamedef readXlsxFile(fname, 阅读全文
posted @ 2021-10-05 20:31 石棠 阅读(59) 评论(0) 推荐(0)
摘要:import pymssqlimport loggingimport mathimport datetimefrom DataCleaning.library.functions.processBar import *def list2SQL(cursor, list0, tempTableName 阅读全文
posted @ 2021-10-05 20:30 石棠 阅读(39) 评论(0) 推荐(0)
摘要:import osimport loggingimport datetimefrom DataCleaning.library.functions.appendString2Txt import *from DataCleaning.library.functions.createTxt impor 阅读全文
posted @ 2021-10-05 20:30 石棠 阅读(38) 评论(0) 推荐(0)
摘要:import jsonfrom collections import namedtupledef json2Object(jsonObj): return json.loads(jsonObj, object_hook=lambda d: namedtuple('jsonMain', d.keys( 阅读全文
posted @ 2021-10-05 20:29 石棠 阅读(50) 评论(0) 推荐(0)
摘要:import loggingimport os# from DataCleaning.library.functions.changeDirectory import *from DataCleaning.library.config.config import LOG_FORMAT, DATE_F 阅读全文
posted @ 2021-10-05 20:28 石棠 阅读(49) 评论(0) 推荐(0)
摘要:# input: xlrd.book.Book# output: two sheetsdef getTwoSheets(bk): return bk.sheets()[0], bk.sheets()[1] 阅读全文
posted @ 2021-10-05 20:28 石棠 阅读(29) 评论(0) 推荐(0)
摘要:# from DataCleaning.library.functions.getLatestFileName import *# getLatestFileName(keyWord, fileNames, sep = "_", comparePath = "")from DataCleaning. 阅读全文
posted @ 2021-10-05 20:27 石棠 阅读(43) 评论(0) 推荐(0)
摘要:import pymssqlimport loggingfrom DataCleaning.library.functions.getFileNames import *from DataCleaning.library.functions.readXlsxFile import *from Dat 阅读全文
posted @ 2021-10-05 20:26 石棠 阅读(28) 评论(0) 推荐(0)
摘要:import datetimeimport xlrddef excelDateFormatter(sh, i, j, sep = "-"): if sh.cell(i, j).ctype == 3: cell = sh.cell_value(i, j) date = datetime.datetim 阅读全文
posted @ 2021-10-05 20:25 石棠 阅读(34) 评论(0) 推荐(0)
摘要:from DataCleaning.library.functions.floatFormatter import *from DataCleaning.library.functions.list2SQL import *from DataCleaning.library.functions.ex 阅读全文
posted @ 2021-10-05 20:25 石棠 阅读(64) 评论(0) 推荐(0)
摘要:from DataCleaning.library.functions.changeDirectory import *def createTxt(string, target, targetPath = ""): tempWD = os.getcwd() if targetPath != "": 阅读全文
posted @ 2021-10-05 20:24 石棠 阅读(26) 评论(0) 推荐(0)
摘要:# load all packages with necessary functionsimport osimport sysimport datetimeimport loggingimport gcfrom DataCleaning.library.functions.initLogConfig 阅读全文
posted @ 2021-10-05 20:24 石棠 阅读(20) 评论(0) 推荐(0)
摘要:import pymssqlimport loggingdef createCursor(serverAddress, userName, password, dataBase): # create connection and cursor conn = pymssql.connect(serve 阅读全文
posted @ 2021-10-05 20:23 石棠 阅读(47) 评论(0) 推荐(0)
摘要:import csvimport loggingfrom DataCleaning.library.functions.changeDirectory import *from floatFormatter import *from DataCleaning.library.functions.ad 阅读全文
posted @ 2021-10-05 20:22 石棠 阅读(43) 评论(0) 推荐(0)
摘要:import shutilfrom DataCleaning.library.functions.changeDirectory import *import loggingimport datetimedef copy2Output(outputFileName, storagePath, tar 阅读全文
posted @ 2021-10-05 20:22 石棠 阅读(41) 评论(0) 推荐(0)
摘要:import logging# returns corresponding tempAbbr, tempStdCountryName, tempGEO for given countryNamedef citySearcher(cityName, citySearcherDic): cityName 阅读全文
posted @ 2021-10-05 20:21 石棠 阅读(25) 评论(0) 推荐(0)
摘要:import os# change the current working directory from 'project\src\development' to 'project\volume\data\external'def development2External(naming = ""): 阅读全文
posted @ 2021-10-05 20:20 石棠 阅读(31) 评论(0) 推荐(0)
摘要:def addRow(row, strLines, sep = "|"): strTemp = "" for i in range(len(row)): strTemp += row[i].replace(sep, " ") + sep return strLines + strTemp[:-1] 阅读全文
posted @ 2021-10-05 20:19 石棠 阅读(45) 评论(0) 推荐(0)
摘要:from DataCleaning.library.functions.changeDirectory import *def appendString2Txt(string, target, targetPath = ""): tempWD = os.getcwd() if targetPath 阅读全文
posted @ 2021-10-05 20:19 石棠 阅读(22) 评论(0) 推荐(0)