일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- google apps script
- hive
- Mac
- PostgreSQL
- math
- Redshift
- list
- Excel
- array
- Python
- Java
- matplotlib
- Github
- Kotlin
- dataframe
- Tkinter
- GIT
- Google Spreadsheet
- c#
- Apache
- gas
- SQL
- numpy
- PANDAS
- 파이썬
- Google Excel
- django
- PySpark
- string
- Today
- Total
목록list (22)
달나라 노트
C#에서 여러 요소를 하나의 묶음으로 저장할 수 있는 대표적인 자료형은 Array입니다. Array 관련 내용 = https://cosmosproject.tistory.com/539 C# : array Array는 여러 값들을 하나로 묶어놓은 것을 의미합니다. Python의 list와 비슷한 개념입니다. string[] test_arr = { "Apple", "Banana", "Pineapple" }; array의 생성은 위처럼 할 수 있습니다. string[] -> Arra.. cosmosproject.tistory.com 이렇게 여러 값들을 하나의 묶음으로서 보관할 수 있는 것을 Collection이라고 합니다. 이번에는 List라는 Collection을 알아봅시다. using System; usin..
Python에서는 변수에 숫자나 글자같은 단순한 값 뿐 아니라 여러 값들을 묶어놓은 묶음(collection)을 할당할 수 있습니다. Python에 있는 묶음 데이터(collection)들은 어떤 것이 있으며 각각의 특성이 무엇인지 알아봅시다. 1. list temp_list = [1, 1, 2, 'a', 'bb', '1a2b3c'] temp_list_2 = ['apple'] 가장 먼저 list입니다. 가장 많이 쓰이는 형태입니다. list는 위처럼 대괄호[]로 묶어서 변수에 할당할 수 있습니다. 대괄호 안에는 각각의 요소들이 콤마의 형태로 구분지어져 있습니다. (요소란 collection 안에 있는 하나하나의 구성품들을 의미합니다.) temp_list_2에서 보이는 것 처럼 list 속 요소는 1개일수..
Pandas에서 제공하는 to_list method는 Series에 적용할 수 있으며 적용된 Series를 list 형태로 변환해주는 역할을 합니다. import pandas as pd dict_main = { 'col1': [1, 2, 3, 4, 5, 6], 'col2': ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta'] } df_main = pd.DataFrame(dict_main) print(df_main) list_col2 = df_main.loc[:, 'col2'].to_list() print(list_col2) list_col2 = list(df_main.loc[:, 'col2']) print(list_col2) -- Result col1 col..
collections module의 defaultdict를 이용하면 default값이 있는 dictionary를 생성할 수 있습니다. 이게 무슨 말인지 예시를 통해 알아봅시다. dict_1 = { 'a': 1, 'b': 2 } print(dict_1['c']) -- Result NameError: name 'c' is not defined 위 예시에선 dictionary에 존재하지 않는 key인 c를 참조하려고 하니 NameError가 발생합니다. 당연한 얘기이겠죠. import collections def default_factory(): return 'no_data' dict_2 = collections.defaultdict(default_factory, a=1, b=2) print(dict_2) p..