인공지능, 데이터분석/[python] 문법, 실습문제

[Python] import collections 모듈이란?

마법사 코딩공주 2023. 5. 31. 12:35
728x90
반응형

📌  collections 모듈이란?

파이썬 내장 모듈 중 하나로, 다양한 컨테이너 데이터 타입을 제공하는 모듈이다.

이 모듈은 기본적으로 'list', 'tuple', 'set', 'dict' 등과 같은 데이터 구조를 보다 효율적으로 다룰 수 있다.

 

 

Counter : 요소의 개수를 셀 수 있는 컨테이너 객체를 생성

○ dafaultdict : 딕셔너리의 기본값을 설정할 수 있는 딕셔너리 객체를 생성

○ deque : 양쪽 끝에서 빠른 삽입과 삭제를 지원하는 큐(Deque) 객체를 생성

○ namedtuple : 필드 이름으로 접근할 수 있는 튜플 객체를 생성

○ OrderedDict : 삽입 순서를 기억하는 딕셔너리 객체를 생성

 

참고 : https://docs.python.org/ko/3/library/collections.html

 

collections — Container datatypes

Source code: Lib/collections/__init__.py This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple.,,...

docs.python.org

 

728x90
반응형