군침이 싹 도는 코딩
Python pandas 특정 문자열이 있는곳 찾기 (contains) 본문
데이터 프레임에서 특정 문자가 들어있는곳을 찾으려면 문자열 함수중에 contains를 사용하면
bool 로 보여준다
사용법
df[col].str.contains(찾을단어)
reviews['description'].str.contains('tropical')
>>>
0 True
1 False
2 False
3 False
4 False
...
129966 False
129967 False
129968 False
129969 False
129970 False
Name: description, Length: 129971, dtype: bool
'Python > Pandas' 카테고리의 다른 글
Python csv 파일 콤마처리 (1) | 2022.11.29 |
---|---|
Python pandas concat / merge (0) | 2022.11.25 |
Python Pandas 오름차순 내림차순 정렬 (sort) (0) | 2022.11.25 |
Python Pandas apply (0) | 2022.11.25 |
Python PANDAS OPERATIONS (0) | 2022.11.24 |