Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- swift
- mssql
- urllib
- sqlite
- port
- PyQt
- pandas
- PyQt5
- 맛집
- ubuntu
- 다이어트
- javascript
- node.js
- 유니티
- IOS
- Unity
- tensorflow
- 리눅스
- python
- MS-SQL
- Excel
- 날짜
- ASP
- GIT
- PER
- 함수
- flutter
- Linux
- 라즈베리파이
- MySQL
Archives
아미(아름다운미소)
한국 & 영국 상담 시간 판별 로직 본문
한국 & 영국 상담 시간 판별 로직
보통 상담 시간을 09:00 ~ 18:00라고 가정했을 때의 코드입니다.
import pandas as pd
# 1. UTC 기반의 원본 데이터를 읽고 변환 (한 방 코드)
df['time_utc'] = pd.to_datetime(df['time'], utc=True, errors='coerce')
# 2. 한국 로컬 시간 생성 및 상담 여부 판별
df['time_kr'] = df['time_utc'].dt.tz_convert('Asia/Seoul')
df['is_kr_biz_hours'] = df['time_kr'].dt.hour.between(9, 17) # 09:00 ~ 17:59
# 3. 영국 로컬 시간 생성 및 상담 여부 판별 (서머타임 자동 계산)
df['time_uk'] = df['time_utc'].dt.tz_convert('Europe/London')
df['is_uk_biz_hours'] = df['time_uk'].dt.hour.between(9, 17)
Comments