반응형
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
- Tkinter
- GIT
- google apps script
- 파이썬
- SQL
- Google Spreadsheet
- Python
- PANDAS
- math
- django
- Github
- list
- numpy
- string
- Excel
- dataframe
- matplotlib
- hive
- Google Excel
- c#
- Apache
- Mac
- array
- Redshift
- PySpark
- gas
- Kotlin
- Java
- PostgreSQL
Archives
- Today
- Total
목록합집합 (1)
달나라 노트
Python Basic : set.union (set 합집합 구하기)
union union은 python의 collection중 하나인 집합을 다루는 set의 합집합을 반환합니다. 아래 예시는 set_1과 set_2의 합집합을 구하는 예시입니다. set_1 = {1, 2, 3, 4, 5} set_2 = {2, 3, 5, 6, 8} print(set_1) print(set_2) x = set_1.union(set_2) print(x) - Output {1, 2, 3, 4, 5} {2, 3, 5, 6, 8} {1, 2, 3, 4, 5, 6, 8} 합집합을 구할 땐 단순히 두 set의 요소를 모두 넣어 하나의 set으로 만드는게 아니라, 중복된 요소들은 모두 사라진 후 unique한 값들만 담아내어 합집합을 구합니다. 그래서 위 예시에서 보면 중복된 값들인 2, 3, 5는 결과..
Python/Python Basic
2020. 11. 23. 17:56