반응형
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
- PySpark
- Google Spreadsheet
- Tkinter
- Kotlin
- numpy
- 파이썬
- Github
- math
- Google Excel
- array
- dataframe
- Python
- Apache
- matplotlib
- django
- list
- GIT
- Redshift
- google apps script
- PANDAS
- PostgreSQL
- string
- Excel
- gas
- Java
- hive
- c#
- Mac
- SQL
Archives
- Today
- Total
목록dictionary sort (1)
달나라 노트
Python Basic : sorted method를 이용한 dictionary 정렬, dictionary 정렬하기
dictionary의 값들을 정렬하는 방법에 대해 알아보겠습니다. dict_test = { 3: 'c', 5: 'a', 4: 'b', 1: 'e', 2: 'd', } list_test_sorted = sorted(dict_test.items(), key=lambda x: x[0], reverse=False) dict_test_sorted = dict(list_test_sorted) print(dict_test_sorted) -- Result {1: 'e', 2: 'd', 3: 'c', 4: 'b', 5: 'a'} 위 예시를 봅시다. 초기 dict_test에 정의된 값들은 key가 1, 2, 3, 4, 5가 있는데 전혀 정렬이 되어있지 않습니다. 그래서 sorted method를 이용해서 정렬을 했더니 결..
Python/Python Basic
2022. 1. 16. 19:51