| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- Github
- Excel
- Google Excel
- Kotlin
- Apache
- PostgreSQL
- SQL
- math
- Redshift
- Google Spreadsheet
- GIT
- matplotlib
- c#
- google apps script
- dataframe
- 파이썬
- Tkinter
- Java
- django
- string
- PySpark
- PANDAS
- gas
- hive
- Python
- Presto
- numpy
- list
- array
- Today
- Total
목록Python (387)
달나라 노트
Pandas의 str.contains method는 특정 Series에 적용할 수 있으며 해당 Series에 있는 값들이 어떤 문자열을 포함하고있으면 True, 포함하고있지 않으면 False를 return합니다. Syntax Series.str.contains(string/pattern, case=True/False, regex=True/False) string/pattern : 찾을 문자열 또는 패턴 case : True일 경우 case sensitive(대소문자 구분), False일 경우 case insensitive(대소문자 구분 안함) regex : True일 경우 string/pattern을 regular expression pattern으로 인식. False일 경우 string/pattern을..
Syntax os.path.exists(file_path) os.path.exists는 위처럼 사용 가능합니다. parameter로서 file_path를 받으며 file_path가 실제로 존재하면 True를 존재하지 않으면 False를 반환합니다. |-- test.py |-- test |-- sub_test |-- test.csv # test.py import os print(os.path.exists('test/')) # 1 print(os.path.exists('test/empty_test/')) # 2 print(os.path.exists('test/sub_test/test.csv')) # 3 -- Result True False True 위 예시를 봅시다. python code는 test.py에 ..
python의 내장변수 중 __name__이라는 변수는 해당 python 파일을 직접 실행시키는지 library로 import해서 실행시키는지에 따라 값이 달라집니다. 직접 실행할 경우 -> __name__ == '__main__' library로 import되어 실행된 경우 -> __name__ == '파일명' # name_test.py print(__name__) -- Result __main__ name_test.py 파일을 직접 실행한 경우 __name__이라는 내장변수에는 __main__이라는 값이 저장됩니다. 위 예시의 결과에서 알수있죠. # final.py import name_test -- Result name_test final.py 에서 test.py를 import했습니다. 그리고 fi..
python을 실행하면 기본적으로 설정되는 변수들이 있습니다. 그 중에서 __file__은 현재 python file이 존재하는 경로를 반환해줍니다. print(__file__) -- Result /User/documents/code/test.py 만약 위 print구문이 적힌 파일이 /User/documents/code/test.py라는 경로에 존재하면 위 예시처럼 해당 파일의 절대 경로를 반환해줍니다. import os print (os.path.dirname(__file__)) -- Result /User/documents/code os library를 이용하여 파일 이름 없이 경로만 얻을 수도 있습니다.