# \[데이터] 데이터의 최대/최소/평균

### 코드

{% code title="데이터에서 최댓값을 구할 때" %}

```
@데이터 "데이터셋_이름"에서 "속성_이름"의 최대
```

{% endcode %}

{% code title="데이터에서 최솟값을 구할 때" %}

```
@데이터 "데이터셋_이름"에서 "속성_이름"의 최소
```

{% endcode %}

{% code title="데이터에서 평균값을 구할 때" %}

```
@데이터 "데이터셋_이름"에서 "속성_이름"의 평균
```

{% endcode %}

***

### 설명

데이터에 대한 최대/최소/평균 값을 반환합니다.

* 데이터는 최대/최소/평균 계산이 가능한 숫자형 데이터여야 해요.
* 결측치/문자열이 섞여 있으면 환경에 따라 오류나 누락이 생길 수 있어요.

***

### 주의사항

* 수학 코드를 쓸 때는 앞에 `@수학`을 써야 해요.
* 반올림 기준은 0.5예요.

***

### 파이썬 대응 코드

```
import math
round(x)
math.ceil(x)
math.floor(x)
```

***

### 예시

{% code title="예시 코드" %}

```
인구데이터 = @데이터 "2022~2050 추계 인구" 불러오기
@데이터 "인구데이터"에서 "총인구"의 최대 보여주기
@데이터 "인구데이터"에서 "총인구"의 최소 보여주기
@데이터 "인구데이터"에서 "총인구"의 평균 보여주기
```

{% endcode %}

{% code title="예시 코드의 결과" %}

```
51751065
47106960
50251214.137931034
```

{% endcode %}

***

### 검색 키워드

데이터, 최대, 최소, 평균


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codebook.horang.it/data/undefined-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
