본문 바로가기

Language&Framework&Etc112

결측치 처리 값으로 채우기 df.fillna(값) # 특정값으로 채우기 df.fillna(method='pad') # pad/ffill 앞선행의 값으로 채움 df.fillna(method='bfill') # bfill/backfill 다음 행의 값으로 채움 금융 시계열 분석에서는 보통 앞선 행의 값을 가져온다고 함(forward fill) 결측치 제거 df.dropna() df.dropna(axis = 'rows' or 'columns') df.dropna(axis = 0 or 1) 2023. 2. 20.
Datetime 다루기 날짜표현(STR -> DATETIME) import datetime format = '%Y-%m-%d %H:%M:%S' datetime_str = '2018-05-13 12:34:56' # STRING datetime_dt = datetime.datetime.strptime(datetime_str, format) # STRING -> DATETIME print(type(datetime_dt)) print(datetime_dt) 2018-05-13 12:34:56 날짜표현(DATETIME -> STR) datetime_str = datetime_dt.strftime('%Y-%m-%d %H:%M:%S') print(type(datetime_str)) # print(datetime_str) # 2018-08-.. 2023. 2. 19.
판다스 기본 학습 # 인덱스 차이 pd_series = pd.Series([1, 2, 3, 4], index=["일", "이", "삼", "사"]) pd_series_no_idx = pd.Series([1, 2, 3, 4]) index 있을 때 일 1 이 2 삼 3 사 4 dtype: int64 index 없을 때 0 1 1 2 2 3 3 4 dtype: int64 range pd.Series(range(100, 110)) 0 100 1 101 2 102 3 103 4 104 5 105 6 106 7 107 8 108 9 109 dtype: int64 인덱스 접근 pd_series.index Index(['일', '이', '삼', '사'], dtype='object') 값 접근 pd_series.values array([.. 2023. 2. 19.
from win32com.shell import shellcon, shell ImportError: DLL load failed while importing shell: 지정된 프로시저를 찾을 수 없습니다. (base) C:\Windows\system32>conda create -n tf12 python=3.8 WARNING conda.exceptions:print_unexpected_error_report(1216): KeyError('pkgs_dirs') Traceback (most recent call last): File "C:\Users\choi\anaconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__ return func(*args, **kwargs) File "C:\Users\choi\anaconda3\lib\site-packages\conda\cli\main.py", line 87, in _main exit_code = .. 2022. 7. 19.