티스토리 뷰
cCompanyInfoCollector
from pandas import DataFrame
from datetime import datetime, timedelta
from BExcel import cBExcel
class cCompanyInfoCollector:
def __init__(self):
pass
def CollectCompanyInfo_SMINFO(self, fileName=None):
if not fileName:
fileName = "Companies.txt"
date0 = datetime.now()
dateName = date0.strftime("%Y%m%d")
excelName = "Companies_SMINFO_"+dateName+".xlsx"
file1 = open("companies.txt", 'r', encoding="utf-8")
CompaniesDF = DataFrame()
isCompanyInfo = False
while True:
line1 = file1.readline()
if not line1:
file1.close()
break
if isCompanyInfo:
if line1.find("페이지로")>0:
isCompanyInfo = False
continue
infos11 = line1.split("\t")
print(infos11)
info11 = {
'CompanyName': infos11[0].strip(),
'CEO': infos11[1].strip(),
'CompanyType': infos11[2].strip(),
'BusinessCategory': infos11[3].strip(),
'Address': infos11[4].strip()
}
if CompaniesDF.empty:
CompaniesDF = DataFrame([info11])
else:
CompaniesDF = CompaniesDF.append(info11, ignore_index=True)
if line1.startswith("기업명\t대표자명"):
isCompanyInfo = True
continue
if CompaniesDF.empty: return
excel1 = cBExcel()
dataDF0 = excel1.LoadData(excelName)
if dataDF0.empty:
excel1.SaveData(CompaniesDF, excelName)
else:
dataDF0 = dataDF0.append(CompaniesDF, ignore_index=True)
excel1.SaveData(dataDF0, excelName)
print(dataDF0)
반응형
'SWDesk' 카테고리의 다른 글
[Python] DataFrame에서 최근 값 찾기 to Dict (0) | 2022.06.23 |
---|---|
[Python] 문자열 형태의 배열을 리스트로 변환 (0) | 2022.06.05 |
[Python] Send Kakao Message througn KakaoAPI (0) | 2022.06.04 |
[Python] Send Email through Outlook (0) | 2022.06.03 |
[Python] Testing ... DataFrame (0) | 2022.05.31 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- image
- 전압
- 빌리언트
- 혁신
- badp
- 전류
- 허들
- 배프
- DYOV
- Innovations&Hurdles
- 치매
- 둎
- arduino
- ServantClock
- 오블완
- 치매방지
- BSC
- 심심풀이
- Innovation&Hurdles
- Video
- 혁신과허들
- 아두이노
- 심심풀이치매방지기
- bilient
- Hurdles
- 티스토리챌린지
- Innovations
- Decorator
- 절연형
- 전압전류모니터링
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함