반응형
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
- PANDAS
- gas
- string
- Mac
- math
- Kotlin
- Java
- 파이썬
- GIT
- SQL
- Github
- numpy
- matplotlib
- Google Spreadsheet
- Excel
- c#
- Python
- Google Excel
- Tkinter
- Redshift
- dataframe
- hive
- PostgreSQL
- django
- google apps script
- Apache
- PySpark
- list
- array
Archives
- Today
- Total
목록setdefault (1)
달나라 노트
Python Basic : dictionary setdefault (dictionary에 존재하지 않는 key를 전달했을 때 발생하는 에러 해결. dictionary용 nvl)
Syntax dictionary.setdefault(key, default_value) setdefault method는 dictionary에 적용할 수 있는 method이며 2개의 인자를 받습니다. - key setdefault method는 전달받은 key값에 대한 value를 dictionary에서 찾아 return 해줍니다. - default_value 만약 전달받은 key값이 dictionary에 없을 경우 default_value를 return합니다. dict_test = { 'key1': 1, 'key2': 2, 'key3': 3 } val_result_1 = dict_test.setdefault('key1', 10) print(val_result_1) -- Result 1 위 예시를 봅시다..
Python/Python Basic
2022. 10. 11. 00:34