반응형
# 처방
def get_df_prescribed(self):
df_prescribed = self.df_order.loc[self.df_order["처방구분"].str.match("처방")]
print(df_prescribed)
return df_prescribed
# 비처방
def get_df_not_prescribed(self):
df_not_prescribed = self.df_order.loc[self.df_order["처방구분"].str.match("비처방")]
print(df_not_prescribed)
return df_not_prescribed
contains로는 겹쳐버리는 문자가 있으면 걸러내지 못하는 데이터를 match를 이용해서 걸러낸다.
반응형
'프로그래밍 > python' 카테고리의 다른 글
문자열에서 숫자만 가져오는 여러 방법 (0) | 2022.09.29 |
---|---|
현재 날짜 가져오기 및 특정 일자 더하기 (0) | 2022.09.28 |
브라우저가 멈출 정도의 로딩에 빠졌을 때 파이썬이 기다려 줄 수 있는 최대 시간 설정 (selenium의 time out exception 방지) (0) | 2022.09.23 |
Decompyle++ 윈도우 exe 파일 (14) | 2022.09.20 |
dataframe 칼럼과 list를 비교하여 데이터 추출 (0) | 2022.09.19 |