python

    pandas dataframe 이미지 테이블 export시 style로 멀티 인덱스 보이지 않게 하기

    https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.hide.html pandas.io.formats.style.Styler.hide — pandas 2.1.4 documentation Warning This method only works with the output methods to_html, to_string and to_latex. Other output methods, including to_excel, ignore this hiding method and will display all data. This method has multiple functionality depending upon the combin..

    파이썬 APScheduler 실행해보기

    https://velog.io/@jw3418/python%EC%9C%BC%EB%A1%9C-daemon-scheduler-%EA%B5%AC%ED%98%84 python으로 daemon scheduler 구현 데이터 자동 추가를 위해 linux crontab을 이용하려 했는데, 실행하고자 하는 crawling.py 파일에 외부 라이브러리가 많아서 그런지 (crontab 파일에 따로 library path를 추가해야 할듯?) crontab이 매달 실행 velog.io 참고 블로그 def job_function(): subprocess.run(args=[sys.executable, "./main.py"]) sched = BackgroundScheduler(timezone='Asia/Seoul') # interv..

    파이썬 pyqt QComboBox style

    # enabled = False 일 경우 QComboBox:disabled{ background-color: #e0e0e0; border: 2px solid #e0e0e0; } # 기본 style QComboBox{ border: 2px solid #e0e0e0; } # 드롭다운 화살표 style QComboBox::down-arrow{ image: url(:/icon/icon/down-arrow.png); } # 드롭다운 화살표 버튼 style QComboBox::drop-down:button{ background-color: transparent; }

    파이썬 pyqt pyside qcheckbox 테두리 style

    # 일반 체크박스 QCheckBox{ margin-bottom: 5px; } # 체크박스 자체 QCheckBox:indicator { border: 2px solid #e0e0e0; background: none;padding-bottom: 50px; } # 체크박스 체크 후 QCheckBox:indicator:checked { background-color: black; }

    fast api crud 만들기

    # create user = User( name="kim", age=1) db.add(user) db.commit() db.refresh(user) # read user_list = db.query(User) # update db_user = db.get(User, user.id) user_data = user.dict(exclude_unset=True) for key, value in user_data.items(): setattr(db_user, key, value) db.add(db_user) db.commit() db.refresh(db_user) # delete db.query(User).delete() db.commit()

    파이썬 logging 에서 setLevel 이 not work 할 때

    삽질 30분 삽질 사유 콘솔에 로그가 찍히도록 StreamHandler 를 추가하고, 파일에도 찍도록 FileHandler 를 추가했다. 정상적이게 콘솔에 찍히고, 파일에도 출력됩니다. 그런데, 나오지 않았던 다른 라이브러리에 debug 로그가 쭉 찍히는걸 보고 setLevel를 INFO 레벨로 설정했는데 왜 나오지? 했는데, 30분의 삽질 끝에 각 핸들러에도 로그 레벨 설정이 가능한걸 알았다. import logging from logging.handlers import TimedRotatingFileHandler # 로그 생성 logger = logging.getLogger() # 로그의 출력 기준 설정 logger.setLevel(logging.INFO) # 여기 설정 했는데 적용이 안된다! # 로..

    pyqt label 에 a태그 클릭 시 링크 오픈 안될 경우

    label.setOpenExternalLinks(True) 라벨에 외부링크 설정값을 True 로 바꿔준다.

    파이썬 filter, lambda를 이용한 새로운 리스트 만들기

    now_list = [1, 2, 3, 4, 5, 6, 7] except_list = [1, 2, 3, 4] new_list = list(filter(lambda l: l not in except_list, now_list)) print(new_list) # [5, 6, 7] now_list에서 except_list에 있는 값을 제거 후 새로운 new_list를 만든다.