본문 바로가기
목차
Pages

[Python] Collections

by ds31x 2023. 10. 6.
728x90
반응형

Python에는 여러 데이터를 담아두고 다룰 수 있는 다양한 컬렉션(collection) 클래스들이 있음.

대표적으로 list, tuple, set, dict 등이 있는데 이들의 기능을 설명하는 abstract base class들로부터 시작하여 각 collection 클래스를 살펴보고, 이들의 동작을 설명하는 iterable, iterator 및 이들을 효과적으로 생성하는 comprehension을 다룸. 추가적으로 generator 도 같이 다룸.

collections.abc

2024.04.15 - [분류 전체보기] - [Python] collections.abc

 

[Python] collections.abc

2023.10.06 - [Pages] - [Python] Collections collections.abc 와 Python의 DataStructure. Python의 Data structure는 실제적으로 collections.abc 라는 abstract base class (abc) mechanism를 통한 hierarchy로 구성된다. 일반적으로 list, tuple

ds31x.tistory.com


list (sequence type)

2023.07.12 - [Python] - [Python] list (sequence type) : summary

 

[Python] list (sequence type) : summary

list는 ordered mutable collection으로, collection을 위한 python data type들 중 가장 많이 사용된다. C에서의 array와 같이 가장 기본적인 collection임. 단, heterogeneous item을 가질 수 있으며, 여러 methods를 가지는

ds31x.tistory.com

2023.07.17 - [Python] - [Python] List's methods

 

[Python] List's methods

Methods of List일반적으로 object에 대해 method를 호출할 경우,해당 object의 관련 attribute의 값이 바뀌고 None을 반환하는 경우가 많다.(단, NumPy나 Pandas 등의 경우, 해당 object의 값을 바꾸면서 바뀐 object

ds31x.tistory.com

 

 


tuple

2023.10.06 - [Python] - [Python] tuple

 

[Python] tuple

tuple Tuple은 immutable list라고 자주 불릴 정도로 list와 유사하다.더보기2024.02.03 - [Python] - [Python] mutable and immutable: Mutability [Python] mutable and immutable: MutabilityMutabilityPython에서 Data Types를 구분짓는 중요

ds31x.tistory.com


set and frozenset

2023.07.12 - [Python] - [Python] set and frozenset

 

[Python] set and frozenset

set & frozenset set(집합) : 특정 conditions를 만족(=집합에 속함)시키는 구별 가능한(distinct) object의 collection. set의 중요한 수학적 특징은특정 object가 set에 속하는지 아닌지를 명확히 판별(특정 conditions

ds31x.tistory.com


dictionary (mapping type)

2023.07.11 - [Python] - [Python] dictionary (Mapping type) : basic

 

[Python] dictionary (Mapping type): basic

dictionary (dict)Python에서 dictionary는key-value pair를 item으로 가지는unorderedmutablecollection임: collections.abc.Mapping 의 구현!set과 함께 curly bracket (or brace)를 사용하는데, empty dictionary가 바로 {}로 표현됨(diction

ds31x.tistory.com

 

2023.07.11 - [Python] - [Python] Dictionary's methods

 

[Python] Dictionary's methods

Dictionary's methods비우기dic.clear()Dictionary instance (or object) dic을 전부 비움.모든 key-value 쌍들이 제거됨.값 얻어오기dic.get(key)key에 해당하는 키를 가지고 있는 value를 반환. 만약 없다면 None이 반환됨.di

ds31x.tistory.com


Comprehension

https://dsaint31.tistory.com/500

 

[Python] List Comprehension

List ComprehensionList comprehension is an expression(표현식) that transforms a collection (not necessarily a list) into a list.list를 생성하는 expression 으로, 원본이 되는 collection 의 모든 item 혹은 일부 item들에 대해 같은 op

dsaint31.tistory.com


collections 모듈의 Special Containers

2025.04.04 - [Python] - [Py] collections 모듈 (summary) - 작성중

 

[Py] collections 모듈 (summary) - 작성중

Python의 collections 모듈은 파이썬의 built-in 자료구조를 확장한 special container 클래스들을 제공함.1. Counter요소의 개수를 세는 dictionary의 subclass.해시 가능한 객체의 카운트를 저장함.from collections impor

ds31x.tistory.com


Iterable and Iterator, and Generator

oop를 배우고 나서, special method 와 over-riding, inheritance 의 개념을 확실히 알고 나서 볼 것.

https://dsaint31.tistory.com/501

 

[Python] Iterable and Iterator, plus Generator

Iterable and Iteartor, and GeneratorIterable for 문에서 in 뒤에 위치하여 iterate (반복, 순회)가 가능한 object를 가르킴.__iter__() 라는 special method를 구현하고 있으며, 이를 통해 자신에 대한 iterator object를 반환

dsaint31.tistory.com


같이보면 좋은 자료들

2023.10.06 - [분류 전체보기] - [Summary] Python 정리

 

[Summary] Python 정리

Programming Language and Python 소개2023.10.23 - [Python] - [Python] Programming Language and Introduction of Python. [Python] Programming Language and Introduction of Python.Computer and Programhttps://dsaint31.tistory.com/436: computer 의 정의와 pr

ds31x.tistory.com


 

728x90

'Pages' 카테고리의 다른 글

[Python] String : 문자열  (1) 2023.10.06
[Python] Control Structure and Control Flow  (1) 2023.10.06
[Python] function 과 Scope, Name Space 정리 - Summary  (0) 2023.10.06
Shell 관련 정리  (0) 2023.10.02