DATA-13 · DATA SCIENCE

공식 API·수집 기록·자료 개정Official APIs, collection logs and revisions

받은 페이지·원 응답·키·스키마·수정값을 연결해 재현하기Connect received pages, raw replies, keys, schemas and revisions

실습 6종 · 풀이 포함 연습문제 60개6 labs · 60 exercises with solutions

기초Foundations

1. 여섯 장의 카드 중 세 장을 받았다1. Three cards have arrived from a set of six

자료 상자에 A·B·C·D·E·F라는 이름표가 붙은 카드 여섯 장이 있다고 합시다. 카드의 설명용 숫자는 차례로 10·20·30·40·50·60입니다. 창구는 한 번에 세 장씩 줍니다. 첫 봉투에서 A·B·C를 받으면 전송은 성공했고 세 숫자를 읽을 수도 있습니다. 그러나 아직 D·E·F는 받지 못했습니다.

고정된 설명용 카드 여섯 장
카드 키ABCDEF
설명용 값102030405060
들어 있는 페이지111222

첫 세 값의 평균은 (10+20+30)/3=20입니다. 여섯 값을 모두 받으면 합 210을 6으로 나누어 35입니다. 평균 계산기의 덧셈은 두 경우 모두 맞습니다. 어떤 카드를 받았는지가 달랐습니다. 이번 장은 자료를 받는 과정부터 계산의 일부로 다룹니다.

Imagine six labeled cards A through F, carrying toy values 10, 20, 30, 40, 50 and 60. A counter supplies three cards per envelope. Receiving A, B and C is a successful transfer containing readable numbers, but D, E and F have not arrived.

Six fixed toy records
Card keyABCDEF
Toy value102030405060
Response page111222

The first three values average 60/3=20. All six sum to 210 and average 35. Both additions are correct; they use different cards. Treat the collection process as part of the calculation.

기초Foundations

2. API는 정해진 말로 묻는 자료 창구다2. An API is a counter with a documented request language

사람에게 “한국의 2019년부터 2024년까지 GDP 자료를 주세요”라고 말하는 대신, 프로그램은 정해진 주소와 이름 붙은 설정값을 보냅니다. 이런 프로그램 간 창구를 API라고 부릅니다. 답을 사람이 보는 웹페이지로 줄 수도 있지만, 여기서는 이름과 값의 구조를 가진 JSON 또는 표 형태의 CSV 응답을 읽습니다.

창구 문서에는 어떤 주소를 쓸지, 국가·지표·기간·페이지를 어떤 이름으로 적을지, 답이 어떤 모양인지가 나옵니다. 먼저 묻고 싶은 행의 뜻을 한 문장으로 정합니다. “한국, 2019–2024년, 1인당 GDP, 2015년 불변 USD”처럼 지역·시점·측정량·단위를 함께 적으면 비슷한 이름의 다른 열을 고르는 일을 줄일 수 있습니다.

실제 수집은 서버와 통신하는 일입니다. 이 장의 라이브 실습은 주소 만들기와 보관된 답 읽기를 JavaScript로 수행합니다. 정해진 Python/R 파일은 따로 실제 실행해 둔 오프라인 재현 경로입니다.

Instead of telling a person “give me Korean GDP data for 2019–2024,” a program sends a documented address and named settings. An application programming interface, or API, provides that program-facing counter. Here the retained replies are structured JSON or tabular CSV.

Documentation specifies routes, parameter names and response structure. Start by describing the desired rows in ordinary language: Korea, 2019–2024, GDP per person, constant 2015 USD. Naming geography, period, measure and unit helps distinguish similar columns.

Collection itself communicates with a server. The live labs construct addresses and inspect retained replies in JavaScript. Fixed Python/R programs form a separate, actually executed offline reproduction path.

기초Foundations

3. 카드 이름을 관측의 뜻으로 확장한다3. Extend card labels into observation keys

카드 A의 이름표는 숫자 10을 담은 한 행을 구별합니다. 실제 GDP 표에서는 연도만으로 충분하지 않습니다. 2024년이라는 이름표는 여러 국가와 여러 지표에 붙을 수 있습니다. 국가 코드·연도·지표 코드를 함께 묶어 한 관측을 가리킵니다.

세 부분으로 관측을 구별하는 설명용 표
국가연도지표관측 키
KOR2024NY.GDP.PCAP.KDKOR|2024|NY.GDP.PCAP.KD
KOR2023NY.GDP.PCAP.KDKOR|2023|NY.GDP.PCAP.KD
FRA2024NY.GDP.PCAP.KDFRA|2024|NY.GDP.PCAP.KD

이처럼 값의 뜻을 기준으로 만든 이름표를 의미 키라고 부르겠습니다. 페이지 1의 첫 행이라는 위치는 별도 기록입니다. 같은 관측이 다음 수집에서는 다른 페이지나 위치에 올 수 있으므로 위치 자체를 영구적인 관측 이름으로 삼지 않습니다.

Card A identifies a particular row containing ten. A real GDP table needs more than a year: 2024 occurs for many countries and indicators. Combine country code, year and indicator code to name one observation.

Toy examples of three-part observation keys
CountryYearIndicatorObservation key
KOR2024NY.GDP.PCAP.KDKOR|2024|NY.GDP.PCAP.KD
KOR2023NY.GDP.PCAP.KDKOR|2023|NY.GDP.PCAP.KD
FRA2024NY.GDP.PCAP.KDFRA|2024|NY.GDP.PCAP.KD

Call this a semantic key: a name built from what an observation means. Its position, such as the first row of page one, is another field. A later collection can place the observation elsewhere, so a position alone is not a permanent observation name.

기초Foundations

4. 주소의 경로와 물음표 뒤 설정을 읽는다4. Read a route and its query settings

아래 주소에서 국가와 지표는 경로에 있고, 물음표 뒤에는 설정이 붙습니다. 설정 사이의 &는 두 조건을 같은 요청에 담는 구분자입니다. 웹주소의 문자와 보통 문장의 문장부호는 역할이 다르므로 주소를 복사할 때 임의로 띄어쓰지 않습니다.

https://api.worldbank.org/v2/country/KOR/indicator/NY.GDP.PCAP.KD?source=2&date=2019:2024&format=json&per_page=3&page=1

date=2019:2024는 양끝을 포함한 요청 기간, format=json은 답의 형식, per_page=3은 한 응답의 최대 행 수 설정, page=1은 요청한 페이지입니다. 이 주소를 만들었다는 것과 해당 기간의 값이 실제로 존재한다는 것은 별개입니다. 뒤에서 보관된 실제 응답의 내용을 확인합니다.

In this address, country and indicator appear in the route. Settings follow the question mark, separated by ampersands. Copy an address as code rather than inserting ordinary prose spacing into it.

https://api.worldbank.org/v2/country/KOR/indicator/NY.GDP.PCAP.KD?source=2&date=2019:2024&format=json&per_page=3&page=1

date=2019:2024 selects an inclusive period; format=json asks for JSON; per_page=3 sets the page size; page=1 selects a page. Constructing that address does not establish that all requested values exist. Inspect the retained actual reply later.

기초Foundations

5. 여섯 연도와 페이지 크기 3을 손계산한다5. Count six years and a page size of three

2019·2020·2021·2022·2023·2024를 직접 써 보면 여섯 연도입니다. 양끝 연도를 포함할 때 개수는 마지막−처음+1입니다. 2024−2019만 계산하면 간격 다섯 개를 세게 됩니다.

한 국가·한 연간 지표에 해당 연도마다 한 키를 기대하는 선택이라면 후보 키는 여섯 개입니다. 페이지 크기 3은 “전체에 세 관측만 있다”는 뜻이 아닙니다. 실제 답의 total과 pages를 읽어 전체 행 수와 페이지 수를 따로 확인합니다.

서로 다른 빈도나 국가 묶음으로 바꾸면 연도 개수만으로 전체 행 수를 정할 수 없습니다. 이 장의 요청 실습이 반환하는 연간 후보 수는 선언한 단일 국가·연간 범위의 개수입니다.

Write the years 2019 through 2024: six labels. Inclusive counting uses last−first+1. Subtracting 2019 from 2024 alone counts five gaps.

For a selected single-country annual indicator with one expected key per year, there are six candidate keys. Page size three does not mean only three observations exist. Read total and pages to distinguish total rows from response pages.

Other frequencies or country sets need another count. The request lab’s candidate count refers to its declared single-country annual range.

기초Foundations

6. 관측기간·자료 갱신일·받은 날을 세 칸으로 둔다6. Separate observation period, update date and retrieval date

실제 보관본은 2019–2024년의 연간 관측 여섯 개를 담습니다. 응답의 lastupdated는 2026-10-08이고 이번 응답을 보관한 날은 2026-10-26입니다. 세 날짜는 각각 무엇을 측정했는지, 자료원이 어떤 갱신일을 적었는지, 언제 이 사본을 받았는지를 설명합니다.

같은 자료의 서로 다른 시점
날짜의 역할이 장의 실제 기록
관측 연도2019–2024
응답의 자료 갱신일2026-10-08
응답 보관일2026-10-26

2024년 행을 2026년에 받았다고 2026년 관측이 되지는 않습니다. 반대로 이 사본이 존재한다는 사실만으로 2024년 당시에도 같은 숫자가 공개되어 있었다고 말할 수는 없습니다. 과거 시점에 가능했던 분석을 재현하려면 그때 사용한 사본이 필요합니다.

The retained reply contains six annual observations for 2019–2024. Its lastupdated field says 2026-10-08; this reply was retained on 2026-10-26. These describe the measured period, the source’s stated update date and the time this copy was obtained.

Different dates attached to the same data
Time roleActual retained value
Observation years2019–2024
Response update field2026-10-08
Reply retrieval date2026-10-26

Retrieving a 2024 observation in 2026 does not turn it into a 2026 observation. This copy also does not prove the same number was available during 2024. Reproducing an analysis using historical information requires its historical copy.

기초Foundations

7. 작은 설정 사전으로 주소를 만든다7. Build an address from a small settings dictionary

Python의 사전에는 설정 이름과 값을 짝지어 넣습니다. urlencode는 이 짝을 웹주소의 질의 문자열로 만듭니다. 여기서는 기간의 콜론을 남기도록 safe=":"를 정했습니다. 다음 코드는 주소를 출력하며 서버에 접속하는 함수는 호출하지 않습니다.

from urllib.parse import urlencode
base = "https://api.worldbank.org/v2/country/KOR/indicator/NY.GDP.PCAP.KD"
settings = {"source": 2, "date": "2019:2024", "format": "json", "per_page": 3, "page": 1}
url = base + "?" + urlencode(settings, safe=":")
print(url)

R에서는 같은 고정 설정을 paste0로 연결할 수 있습니다. 국가·지표를 자유 텍스트로 받는 일반 수집기라면 별도의 값 검증과 URL 인코딩을 해야 합니다. 실습 A는 허용한 국가 코드 모양과 세 지표, 정수 기간·페이지 설정만 받습니다.

A Python dictionary stores settings as name/value pairs. urlencode turns them into a query string; safe=":" retains the period’s colon. This code prints an address and calls no networking function.

from urllib.parse import urlencode
base = "https://api.worldbank.org/v2/country/KOR/indicator/NY.GDP.PCAP.KD"
settings = {"source": 2, "date": "2019:2024", "format": "json", "per_page": 3, "page": 1}
url = base + "?" + urlencode(settings, safe=":")
print(url)

R can join these same fixed settings with paste0. A general collector accepting free text would also need validation and URL encoding. Lab A accepts a constrained country-code shape, three indicators and integer period/page settings.

기초Foundations

8. 실습 A · 기간과 페이지 설정을 직접 바꾼다8. Lab A · Change periods and page settings

처음 2019·마지막 2024·페이지 크기 3·페이지 1을 입력합니다. 주소의 각 부분과 연간 후보 키 여섯 개를 확인합니다. 마지막 연도를 2023으로 바꾸면 후보는 다섯 개가 됩니다. 페이지를 2로 바꾸어도 관측기간은 그대로입니다.

처음을 2025·마지막을 2024로 뒤집으면 정해진 입력 조건을 만족하지 않습니다. 이전의 성공 주소가 남아 새 결과처럼 보이지 않도록 오류 상태를 표시합니다. 다운로드 기록에서는 같은 잘못된 기간을 실제 Python/R 새 프로세스가 거절한 출력도 볼 수 있습니다.

Start with 2019–2024, page size three and page one. Inspect the address and six annual candidate keys. Ending in 2023 instead produces five candidates; changing only to page two leaves the observation period unchanged.

Reversing the range to 2025–2024 violates the declared input condition. Clear the previous successful address when showing that error. The fixed execution records include actual new Python/R processes rejecting the reversed range.

기초Foundations

9. 7행을 세 개씩 담으면 세 봉투다9. Seven rows at three per page need three envelopes

여섯 카드는 3+3으로 나누어 두 봉투에 담습니다. 일곱 카드라면 3+3+1로 세 봉투가 필요합니다. 마지막 봉투를 채울 수 없다고 마지막 카드를 버리지 않습니다. N개를 페이지당 b개 이하로 나눌 때 N>0·정수 b≥1이면 페이지 수는 N/b의 올림입니다.

P=⌈N/b⌉P=\left\lceil N/b\right\rceil

이 장의 빈 설명용 서버는 0행을 담은 페이지 1이 있다고 약속합니다. 따라서 엔진은 N=0에서 max(1,ceil(N/b))를 씁니다. 이는 모든 실제 API의 빈 응답 규칙이 같다는 주장이 아닙니다. 실제 응답 형식을 문서와 함께 읽어야 합니다.

Six cards split as three plus three. Seven split as three plus three plus one, requiring a third envelope. An incomplete last page does not justify dropping its final row. For N>0 records and integer page capacity b≥1, take the ceiling of N/b.

P=⌈N/b⌉P=\left\lceil N/b\right\rceil

The empty toy server explicitly has page one containing zero rows, so the engine uses max(1,ceil(N/b)) at N=0. Actual APIs can choose another empty-response convention; read their documented response.

기초Foundations

10. 요청한 번호와 답이 말한 번호를 비교한다10. Compare the requested page with the response page

실제 첫 요청은 page=1을 보냈고 답의 page도 1입니다. 답에는 pages=2, per_page=3, total=6이 함께 있습니다. 응답의 숫자를 직접 읽어 요청한 번호와 일치하는지 확인합니다.

실제 두 응답의 페이지 메타데이터
받은 답답의 페이지전체 페이지전체 행이번 행누적 유일 키
첫 답12633
둘째 답22636

“첫 요청”과 “첫 페이지”는 다른 말입니다. 첫 요청에 페이지 2를 보낼 수도 있고, 두 번째 요청에서 페이지 1을 다시 받을 수도 있습니다. 시도 순서·요청한 번호·답의 번호를 따로 기록하면 이를 구별할 수 있습니다.

The actual first request asks for page=1, and the reply’s page is one. It also reports pages=2, per_page=3 and total=6. Read the response values instead of assuming they match the request.

Page metadata in the actual two replies
Retained replyReply pageTotal pagesTotal rowsRows hereCumulative distinct keys
First12633
Second22636

The first attempt need not request the first page. A second attempt can request page one again. Record attempt order, requested page and returned page separately.

기초Foundations

11. 6행을 받았지만 이름표는 3개일 수 있다11. Six delivered rows can contain only three keys

설명용 첫 페이지 A·B·C를 두 번 받으면 A·B·C·A·B·C라는 여섯 행입니다. 전체 예상 행 수도 여섯이라 길이만 검사하면 통과합니다. 서로 다른 이름표는 A·B·C의 세 개이며 D·E·F는 여전히 없습니다.

행 개수만으로 완결성을 판단할 수 없는 반례
받은 페이지전송된 행 수서로 다른 키추가 반복 행없는 키
1330D,E,F
1,1633D,E,F
1,2660없음

카드 숫자를 붙이면 반복 자료의 합은 120, 평균은 20입니다. 전체 여섯 카드 평균 35와 다릅니다. 원 응답은 두 번 받은 사실을 보존합니다. 분석용 한 행을 고를 때에는 같은 키의 어느 버전을 선택했는지도 별도로 정합니다.

Receiving A/B/C twice yields six delivered rows: A/B/C/A/B/C. A length check matches the expected six. Yet there are only three distinct keys and D/E/F remain missing.

Counterexample to completeness from row counts alone
Received pagesDelivered rowsDistinct keysExtra repeated rowsMissing keys
1330D, E, F
1,1633D, E, F
1,2660None

Using the toy values, the repeated list sums to 120 and averages 20, rather than the full six-card mean 35. Preserve both original responses. Selecting one analytical row per key is another step that should record the chosen version.

기초Foundations

12. 완결성은 고정된 목록에 대해 확인한다12. Check completeness relative to a fixed collection target

이번 설명용 서버의 예상 목록은 처음부터 A–F로 고정되어 있습니다. 받은 키들의 합집합이 이 목록 전체이고 모든 응답 페이지도 받았을 때 완결하다고 부릅니다. 완결한 뒤 첫 페이지를 다시 받으면 키는 모두 있지만 반복 행도 있습니다. 엔진은 “완결함”과 “반복 없는 완결한 모음”을 두 표시로 반환합니다.

실제 서버가 수집 도중 행을 추가하거나 순서를 바꾸면 다른 문제가 생깁니다. 첫 답과 둘째 답의 전체 수·갱신 정보가 맞는지 비교하고 원 응답을 보관합니다. 그 점검만으로 여러 답이 하나의 원자적 시점에서 생성됐다고 증명되지는 않습니다. 가능하면 버전이 명시된 파일이나 스냅숏을 선택합니다.

The toy target A–F is fixed in advance. Call the collection complete when the union contains every expected key and all response pages arrived. Receiving page one again after completion retains all keys but adds repeated rows. The engine reports completeness separately from a unique complete collection.

A live server adding rows or changing order between calls raises another issue. Compare totals and update fields across responses and retain the originals. Those checks alone do not prove that all replies came from one atomic snapshot. Prefer a versioned file or documented snapshot when available.

기초Foundations

13. 실패한 시도는 관측값 0이 아니다13. A failed attempt is not an observed zero

첫 페이지를 받고 둘째 요청이 실패했다고 합시다. 보관한 카드 수는 세 개입니다. 둘째 페이지에 있었을 D·E·F의 값을 0으로 채우지 않습니다. “응답을 받지 못함”과 “응답 안의 값이 0”은 다른 사건입니다.

실패 뒤 같은 페이지를 다시 요청할 수 있습니다. 시도 기록에는 실패와 재시도를 모두 남기고, 분석에 쓸 실제 성공 답을 선택합니다. 실패 기록의 빈 본문에 성공한 표를 만들어 붙이지 않습니다. 실습 B의 실패 목록은 선언한 설명용 시도이며 브라우저가 재접속하는 기능은 아닙니다.

Suppose page one arrives and the second attempt fails. Three cards have been retained. Do not fill the missing D/E/F values with zeros: no response and an observed zero are different events.

A later attempt may retry that page. Keep both failed and successful attempts and choose an actually usable reply for analysis. Lab B’s failure list is a declared toy history, not a browser networking or retry feature.

기초Foundations

14. 키의 합집합과 반복수를 함께 센다14. Count a union of keys and their multiplicities

유한한 예상 키 집합 K에 N≥1개의 서로 다른 키가 있다고 합시다. 여러 답에서 키 i가 나타난 횟수를 비음수 정수 mᵢ로 둡니다. 받은 행 수 M은 반복수의 합이고, 받은 서로 다른 키 수 U는 한 번 이상 나타난 키의 수입니다.

M=∑i∈KmiU=∑i∈K1{mi>0}U≤M\begin{gathered}M=\sum_{i\in K}m_i\\U=\sum_{i\in K}{\bf1}\{m_i>0\}\\U\le M\end{gathered}

이 고정 목록에서 모든 키를 받았다는 조건은 U=N과 같습니다. 반복까지 없으려면 모든 mᵢ=1이어야 하므로 M=U=N입니다. 다만 실제 수집에서는 예상 목록 밖의 키가 섞이지 않았는지도 따로 확인해야 합니다. 총개수만 같아도 키 집합은 다를 수 있습니다.

Let a finite expected set K contain N≥1 distinct keys. Write mᵢ for the nonnegative integer number of occurrences of key i across received replies. Delivered rows M count all occurrences; U counts keys appearing at least once.

M=∑i∈KmiU=∑i∈K1{mi>0}U≤M\begin{gathered}M=\sum_{i\in K}m_i\\U=\sum_{i\in K}{\bf1}\{m_i>0\}\\U\le M\end{gathered}

Within this fixed list, all keys have arrived exactly when U=N. No repeats additionally requires every mᵢ=1, giving M=U=N. Real collections also need a check for unexpected keys: matching counts need not mean matching sets.

심화Extension

15. 반복수는 평균의 무게가 된다15. Repeated rows change the weights in a mean

고정 집합 K에 서로 다른 키가 N≥1개 있고 같은 키의 숫자가 수집 내내 고정되어 있다고 합시다. 키 i의 값 xᵢ가 mᵢ번 들어오면 그 값은 평균 분자에 mᵢxᵢ로 들어갑니다. 가용 숫자가 모두 정의되고 받은 행이 M≥1개일 때 아래 두 평균을 비교합니다.

xˉK=N−1∑i∈Kxixˉreceived=M−1∑i∈Kmixi\begin{gathered}\bar x_K=N^{-1}\sum_{i\in K}x_i\\\bar x_{\rm received}=M^{-1}\sum_{i\in K}m_ix_i\end{gathered}

A–C를 두 번 받는 경우 반복수는 2·2·2·0·0·0입니다. 큰 값 40·50·60은 평균에 들어가지 않고 작은 세 값이 두 번씩 들어가므로 20이 됩니다. 반복된 키라고 실제 별개 관측을 임의로 지우라는 뜻은 아닙니다. 먼저 키가 무엇을 가리키며 두 행이 같은 관측의 재수신인지 정해야 합니다.

심화로 평균 차이를 Δ, 각 키의 기여를 Dᵢ라고 두면 반복수가 균등하지 않은 정도와 값의 관계로 쓸 수 있습니다. 두 평균이 우연히 같을 수도 있으므로 평균 일치가 수집 완결성을 증명하지는 않습니다.

Δ=xˉreceived−xˉKDi=(mi−M/N)(xi−xˉK)Δ=M−1∑i∈KDi\begin{gathered}\Delta=\bar x_{\rm received}-\bar x_K\\D_i=(m_i-M/N)(x_i-\bar x_K)\\\Delta=M^{-1}\sum_{i\in K}D_i\end{gathered}

Let fixed set K contain N≥1 distinct keys, with each value fixed during collection. If value xᵢ arrives mᵢ times, it contributes mᵢxᵢ to the numerator. With all values defined and M≥1 delivered rows, compare the two means.

xˉK=N−1∑i∈Kxixˉreceived=M−1∑i∈Kmixi\begin{gathered}\bar x_K=N^{-1}\sum_{i\in K}x_i\\\bar x_{\rm received}=M^{-1}\sum_{i\in K}m_ix_i\end{gathered}

Receiving A–C twice gives multiplicities two/two/two/zero/zero/zero. Values 40, 50 and 60 are absent while the lower values repeat, yielding mean 20. This is not a rule to delete genuinely distinct observations sharing a label: establish the meaning of the key first.

Write Δ for the mean change and Dᵢ for each key’s contribution. The advanced identity relates the change to unequal multiplicities and values. The means can coincide by accident, so mean agreement does not establish collection completeness.

Δ=xˉreceived−xˉKDi=(mi−M/N)(xi−xˉK)Δ=M−1∑i∈KDi\begin{gathered}\Delta=\bar x_{\rm received}-\bar x_K\\D_i=(m_i-M/N)(x_i-\bar x_K)\\\Delta=M^{-1}\sum_{i\in K}D_i\end{gathered}
기초Foundations

16. 실습 B · 페이지를 반복하고 빠뜨려 본다16. Lab B · Repeat and omit pages

예상 키 A–F·페이지 크기 3에서 받은 목록을 1, 다시 1·1, 마지막으로 1·2로 바꾸어 표의 행 수·유일 키·없는 키를 비교합니다. 2·1로 순서만 바꾸면 받은 순서는 달라도 키 합집합은 같습니다.

라이브 계산은 선언한 작은 서버를 JavaScript로 추적합니다. 보관된 실제 Python/R 세 예제는 같은 키·경계·반복 규칙을 각각 실행한 결과입니다. 원래 받은 순서를 남기고, 성공한 시도와 실패 목록을 함께 보여 줍니다.

With keys A–F and page size three, change received pages from one to one/one to one/two. Compare delivered rows, distinct keys and missing keys. Reversing the last list to two/one changes delivery order but preserves its union.

Live controls trace a declared small server in JavaScript. Three actual fixed Python/R examples use the same key, page and repetition rules. Preserve delivery order and display successful and failed attempts separately.

기초Foundations

17. 파일의 바이트와 읽은 값은 다른 비교다17. File bytes and parsed values answer different questions

문자열 {"x":1}은 ASCII 문자 일곱 개이고, {"x":1.0}은 아홉 개입니다. UTF-8로 저장한 이 두 예에는 BOM이나 줄바꿈이 없다고 둡니다. 파일 바이트는 다르지만 x라는 칸의 수학적 값은 둘 다 1입니다. 줄바꿈 한 개를 끝에 붙여도 파일 바이트는 다시 달라집니다.

원 응답을 그대로 보관하면 어떤 문자를 받았는지 다시 읽을 수 있습니다. 그다음 읽기 프로그램이 객체·목록·숫자로 바꾼 결과를 따로 둡니다. 바이트 비교는 “같은 파일인가”, 값 비교는 “같은 관측값인가”라는 질문에 가깝습니다. 뒤의 개정 비교에서는 두 질문을 나누어 계산합니다.

{"x":1} contains seven ASCII characters; {"x":1.0} contains nine. Assume UTF-8 without a BOM or newline in these examples. The file bytes differ, although the mathematical value of x is one in both. Appending a newline changes the bytes again.

Retain the original reply to recover the received text. Keep the parser’s objects, arrays and numbers as a separate representation. Byte equality concerns the file; value equality concerns selected observations. The revision comparison checks these separately.

기초Foundations

18. 중괄호는 이름 붙은 칸, 대괄호는 순서 있는 목록이다18. Braces hold named fields; brackets hold an ordered list

JSON 객체는 {"key":"A","value":10}처럼 이름과 값을 짝짓습니다. "key"와 "value"는 칸 이름이고 A는 문자열, 10은 숫자입니다. 여러 객체를 대괄호 안에 넣으면 순서 있는 목록이 됩니다.

[{"key":"A","value":10},{"key":"B","value":null}]

이 예의 null은 JSON에 직접 적힌 값입니다. 객체 이름과 문자열에는 큰따옴표를 씁니다. Python 코드의 바깥 작은따옴표로 이 JSON 문장을 감쌀 수는 있지만, JSON 문장 자체의 문자열 따옴표를 작은따옴표로 바꾸지는 않습니다.

JSON을 성공적으로 읽었다는 말은 문법이 맞아 객체로 바꿀 수 있었다는 뜻입니다. 그 객체에 필요한 열·단위·행이 있는지는 다음 단계의 질문입니다.

A JSON object pairs names with values, as in {"key":"A","value":10}. Here A is a string and ten is a number. Brackets can collect several objects in an ordered array.

[{"key":"A","value":10},{"key":"B","value":null}]

null is explicitly present JSON content. JSON field names and strings use double quotes. A Python single-quoted string can contain this JSON text, but single quotes do not replace the JSON text’s own double quotes.

Successful parsing means the text can be converted according to the JSON grammar. Required columns, units and records need further checks.

기초Foundations

19. 첫 항목이 관측 한 행이 아닐 수 있다19. The first array item need not be an observation row

실제 World Bank 응답의 바깥 목록은 두 항목입니다. 첫째는 페이지·전체 행 수 같은 메타데이터 객체이고, 둘째가 관측 객체들의 목록입니다. 바깥 목록 길이 2를 관측 두 행으로 세지 않습니다. 첫 페이지의 실제 관측 수는 둘째 항목 안의 세 개입니다.

설명용으로 아래처럼 두 층을 따로 꺼내 봅니다. Python 목록의 첫 위치는 0입니다. 이름을 읽는 대괄호와 위치를 읽는 대괄호의 차이도 한 단계씩 확인합니다.

import json
reply = json.loads('[{"page":1,"pages":2}, [{"key":"A","value":10}]]')
metadata = reply[0]
records = reply[1]
print(metadata["page"])
print(records[0]["key"])

출력은 순서대로 1과 A입니다. R의 첫 위치는 1이므로 첨부 보조함수로 읽은 답에서는 reply[[1]]이 메타데이터, reply[[2]]가 행 목록입니다. 관측의 의미 키는 이런 언어별 위치 번호와 별도입니다.

The outer World Bank response has two items: a metadata object and an array of observation objects. Its outer length two is not an observation count. The actual first page has three objects inside the second item.

Unpack a small example one layer at a time. Python positions start at zero; distinguish positional access from access by a field name.

import json
reply = json.loads('[{"page":1,"pages":2}, [{"key":"A","value":10}]]')
metadata = reply[0]
records = reply[1]
print(metadata["page"])
print(records[0]["key"])

The output is one followed by A. R positions start at one: after reading with the included helper, reply[[1]] holds metadata and reply[[2]] holds records. An observation’s semantic key remains separate from either language’s positions.

기초Foundations

20. 없는 칸과 null이 적힌 칸을 나란히 놓는다20. Put an absent field beside an explicit null

A 행에는 "value":"1", B 행에는 "value":null이 있고 C 행에는 value라는 이름 자체가 없다고 합시다. 세 행 모두를 “값이 있나?” 한 가지 질문으로 뭉치면 차이를 놓칩니다. 먼저 칸 이름이 있는지, 있으면 그 안이 null인지, 아니면 어떤 종류의 값인지 순서대로 묻습니다.

존재·내용·검사 결과의 세 단계
행value 이름이 있나?그 칸의 내용선언한 규칙의 판정
A예문자열 "1"유효한 수치 문자열
B예nullnull 허용 시 유효
C아니오칸 자체 없음필수 칸이면 위반

Python에서는 "value" in row가 이름 존재 검사입니다. row.get("value")만 쓰면 없는 칸도 None을 반환하므로 명시된 null과 구별하려면 앞 검사가 필요합니다. R 보조함수는 null을 전용 태그로 보관하고 "value" %in% names(row)로 이름 존재를 따로 확인합니다.

Suppose A has "value":"1", B has "value":null, and C has no value name at all. Ask three questions in order: is the field present, is its content null, and otherwise what kind of value is it?

Presence, content and validation are separate
Rowvalue name present?ContentDeclared-rule result
AYesString "1"Valid numeric text
BYesnullValid if nullable
CNoNo fieldInvalid if required

Python checks presence with "value" in row. Using only row.get("value") returns None for an absent field too. The R helper preserves a distinct null tag; "value" %in% names(row) checks presence separately.

기초Foundations

21. 큰 정수와 소수의 원문을 먼저 보존한다21. Retain large-integer and decimal source tokens

정수 9,007,199,254,740,993은 2⁵³+1입니다. 이 크기에서 binary64 숫자의 간격은 2이므로 2⁵³과 2⁵³+2 사이의 중점입니다. 짝수 방향 반올림으로 binary64 표시값은 9,007,199,254,740,992가 됩니다. 원문 정수의 마지막 1을 읽은 뒤 잃어버린 것입니다.

Python의 정수형은 이 정수를 그대로 담을 수 있습니다. 그러나 float로 바꾸거나 JavaScript Number·R의 일반 double 수치로 바꾸면 위 차이가 생길 수 있습니다. 따라서 모든 JSON 읽기가 언제나 같은 정밀도라는 말은 맞지 않습니다.

이 장의 실제 재현용 Python reader는 숫자 토큰을 NumberText라는 문자열 하위형으로, R reader는 data13_json_number 태그가 붙은 문자열로 남깁니다. JSON 숫자와 따옴표 안의 보통 문자열을 구별하면서 원문을 보존합니다. 계산용 수치 변환은 그다음에 명시적으로 합니다.

라이브 schema 실습에서 정확 분수 비교를 원하는 칸은 "value":"1/3"처럼 문자열로 입력합니다. JavaScript의 JSON 숫자로 먼저 읽어 잃은 자릿수를 검사기가 복원한다고 하지 않습니다.

Integer 9,007,199,254,740,993 equals 2⁵³+1. Binary 64 spacing here is two, placing it halfway between 2⁵³ and 2⁵³+2. Ties-to-even rounding gives 9,007,199,254,740,992.

Python integers can retain the original integer. Converting it to float, JavaScript Number or an ordinary R double can produce the rounded value. JSON readers do not all provide identical numeric precision.

The actual Python reference reader tags number tokens as NumberText, a string subtype. The R reader uses a data13_json_number tag. Both distinguish number tokens from ordinary quoted strings while retaining source text; numeric conversion is a later explicit step.

For exact fractions in the live schema lab, supply strings such as "value":"1/3". The validator does not claim to recover digits already lost by a JavaScript JSON-number conversion.

기초Foundations

22. 숫자형·열의 역할·단위를 다른 줄에 기록한다22. Record numeric type, field role and units separately

실제 손글씨 메타데이터에는 입력 Feature 64개와 정답 Target 1개가 있습니다. 고객 메타데이터에는 입력 13개와 정답 1개가 있습니다. “입력 열이 13개”를 표의 전체 열이 13개라고 읽으면 정답 열 하나를 놓칩니다. 각 변수의 역할과 실제 CSV 머리글을 함께 셉니다.

숫자형 정보도 단위와 다릅니다. 고객의 Customer Value는 개별 변수 설명에서 Continuous라고 적혀 있지만, 그것만으로 통화나 계산식을 확정하지 않습니다. units:null은 단위를 보고하지 않았다는 정보입니다. 0원·0초라는 측정값으로 바꾸지 않습니다.

이번 보조함수는 R에 원래 설치된 JSON 패키지가 아니라 이 장에 포함한 제한된 reader입니다. 원파일 100,000바이트·읽을 원문 100,000문자·깊이 64·숫자 토큰 256자를 넘기거나 중복 객체 이름을 만나면 거절합니다. R 문자열에 담을 수 없는 U+0000도 명시적으로 거절합니다. 고유 이름 정책과 지원 범위를 모든 JSON 문법의 필수 조건처럼 일반화하지 않습니다.

The actual digit metadata declare 64 Feature fields and one Target. Customer metadata declare 13 Features and one Target. Reading “13 features” as “13 total columns” loses the outcome column. Compare individual roles with actual CSV headers.

Numeric type is another field. Customer Customer Value has per-variable type Continuous, but that alone establishes neither currency nor its calculation formula. units:null means units were not reported, rather than a measured zero currency amount or zero seconds.

The included R reader is authored support, not a standard installed JSON package. Its limits are 100,000 source-file bytes, 100,000 parsed characters, depth 64 and 256 characters per numeric token. It rejects duplicate names and U+0000, which R character strings cannot hold. These support policies are not universal requirements of JSON grammar.

기초Foundations

23. 스키마는 필요한 칸의 약속을 적은 표다23. A schema writes down the required fields

작은 수집표에서 키는 필수 문자열이고 null은 허용하지 않기로 정합시다. value도 필수이지만 수치 문자열 또는 null을 허용합니다. 이처럼 칸 이름·종류·필수 여부·null 허용을 적은 약속을 스키마라고 부릅니다.

실습에서 선언할 두 칸의 약속
칸종류필수?null 허용?
keystring예아니오
valueexact-number 문자열예예

A의 value가 문자열 "1"이면 이 약속에 맞습니다. 숫자 1을 따옴표 없이 입력하면 “정확 수치 문자열” 규칙에는 맞지 않습니다. 다른 규칙 number는 유한한 JavaScript 수치를 허용하고 integer는 안전한 정수를 요구합니다. 숫자의 종류를 느슨하게 바꾸어 성공 표시를 만들지 않습니다.

검사 통과는 선언한 칸과 종류에 맞았다는 뜻입니다. GDP 단위가 맞는지, 빠진 페이지가 있는지, 관측이 실제로 어떻게 만들어졌는지는 그 검사표에 적지 않았다면 알아내지 못합니다.

Declare a required non-null string key. Also require value, allowing numeric text or null. A schema records such field names, kinds, presence requirements and nullability.

Two declared field rules
FieldKindRequired?Nullable?
keystringYesNo
valueexact-number textYesYes

String "1" satisfies the numeric-text rule; an unquoted number one does not. A separate number rule allows finite JavaScript numbers, while integer requires safe integers. Keep those distinctions explicit.

Passing these rules establishes conformity to the declared fields and kinds. It does not answer questions about GDP units, omitted pages or measurement procedures unless those checks were actually specified.

기초Foundations

24. 실습 C · 이름 없음·null·종류 위반을 바꿔 본다24. Lab C · Change absent, null and wrong-kind fields

두 규칙과 A·B·C 세 행을 입력해 보세요. C에 "value":null을 추가하면 “필수 칸 없음”이 사라집니다. null 허용을 끄면 B와 C는 “허용하지 않는 null”이 됩니다. A의 값 "1"을 "one"으로 바꾸면 수치 문자열 해석에 실패합니다.

0행 목록에서는 위반한 행도 0개입니다. 그 논리값만으로 요청한 관측을 모두 수집했다고 말하지 않습니다. 표에 없는 추가 필드를 몰래 삭제하지 않으며, 값의 원위치도 유지합니다. 실제 다운로드는 잘못된 JSON의 마지막 쉼표를 Python/R이 거절한 기록을 포함합니다.

Use the two rules and rows A/B/C. Adding "value":null to C removes its absent-required violation. Disallowing null instead makes B and C null violations. Replacing A’s "1" with "one" fails numeric-text interpretation.

An empty row list has no violating rows. That logical result does not establish complete collection. Retain extra fields and source positions. The fixed downloads also show actual Python/R failures for malformed JSON with a trailing comma.

기초Foundations

25. 두 파일을 행 번호 대신 뜻이 같은 키로 맞춘다25. Match copies by meaning rather than row position

옛 목록이 A=1·B=2이고 새 목록의 순서가 B=2·A=1이라고 합시다. 첫 행끼리 빼면 2−1=1, 둘째끼리 빼면 1−2=−1이라 값이 바뀐 것처럼 보입니다. A와 A, B와 B를 맞추면 차이는 둘 다 0입니다.

먼저 두 사본의 지역·기간·측정량·단위가 비교 가능한지 확인합니다. 그런 다음 같은 의미 키를 맞춥니다. 지표 코드가 같아도 단위 정의나 기준년이 바뀌면 단순 뺄셈의 해석이 달라질 수 있습니다. 키 일치는 단위 점검을 대신하지 않습니다.

이번 실제 GDP 비교는 같은 여섯 관측과 단위의 보관값을 맞춥니다. 새로 받은 날짜가 다르다는 이유만으로 개정이라고 이름 붙이지 않습니다.

Old rows are A=1/B=2; new rows are B=2/A=1. Subtracting by position produces differences one and −1. Matching A with A and B with B produces zero twice.

First establish comparable geography, period, measure and units, then match semantic keys. Even a stable indicator code can accompany a changed unit definition or base year. Key matching does not replace that check.

The actual GDP comparison matches the same six retained observations and units. Another retrieval date alone is not evidence of numeric revision.

기초Foundations

26. 1과 1.0의 수학적 차이는 0이다26. The mathematical difference between one and 1.0 is zero

A의 옛 원문이 문자열 "1", 새 원문이 "1.0"이라고 합시다. 원문 문자는 다르지만 정확 수치로 읽으면 1=10/10입니다. 새 값−옛 값은 0입니다. B=2도 "2.0"으로 표현만 바꿀 수 있습니다.

보관된 설명용 프로그램은 두 JSON 문장을 각각 바이트로 해시합니다. 순서·공백·수치 표현을 바꿔 해시는 다르지만 두 키의 수학적 값은 그대로인 예를 실제로 실행했습니다. 이 예에서 바꾼 문자를 우리가 직접 알고 있다는 점이 중요합니다.

실제 대형 파일에서 선택한 두 값만 같다고 다른 모든 필드도 같다고 증명되는 것은 아닙니다. 검사한 투영, 곧 골라 비교한 키와 칸의 범위를 함께 적습니다.

Suppose A’s old source text is "1" and its new text is "1.0". The characters differ, but exact numeric interpretation gives 1=10/10, so new minus old is zero. B can similarly change from "2" to "2.0".

The fixed toy programs actually hash two JSON texts whose ordering, whitespace and numeric representation differ while both selected values stay unchanged. In this constructed example we know which characters were changed.

For a large actual file, equality of two selected values does not establish equality of every other field. Record the projection: the keys and fields actually compared.

기초Foundations

27. 새 값에서 옛 값을 빼는 방향을 고정한다27. Fix the direction as new minus old

설명용 A가 1에서 4/3으로 바뀌면 새 값−옛 값은 4/3−1=1/3입니다. 반대로 빼면 −1/3이므로 비교 방향을 이름에 적습니다. 정확 분수 1/3과 화면의 약 0.333333은 함께 보일 수 있습니다.

di=xinew−xioldd_i=x_i^{\rm new}-x_i^{\rm old}

이 식은 두 사본에 키가 있고 두 값이 가용하며 같은 뜻과 단위로 비교된다는 전제에서 씁니다. 양수 차이는 새 사본의 저장값이 더 크다는 뜻입니다. 두 사본의 차이가 경제 현상의 실제 시간 증가인지, 통계 작성법 변경인지까지 차이 하나로 결정하지 않습니다.

Toy A changing from one to 4/3 gives new minus old equal to 1/3. Reversing the direction gives −1/3, so name the direction. Exact fraction 1/3 can be displayed beside approximation 0.333333.

di=xinew−xioldd_i=x_i^{\rm new}-x_i^{\rm old}

Use the difference when the key exists in both copies, both values are available and their meanings/units are comparable. A positive result means the new stored value is larger. The difference alone does not determine whether an economic quantity changed over time or a statistical procedure changed.

기초Foundations

28. null에서 3이 생기면 뺄셈보다 가용성 변화를 적는다28. A null becoming three is an availability change

옛 A에는 null이 있고 새 A에는 3이 있다면, 옛 수치 0이 3으로 증가한 것이 아닙니다. 두 사본 모두 키는 있지만 가용 여부가 달라진 것입니다. 엔진은 이 경우 “가용성 변경”과 미정의인 수치 차이를 함께 둡니다.

반대로 3이 null이 되면 새 사본에서 값을 사용할 수 없어진 상태입니다. 두 사본이 모두 null이면 “동일하게 미가용”입니다. 이 세 경우를 숫자 0으로 모두 채우면 언제 값이 생겼거나 사라졌는지 볼 수 없습니다.

미가용 값과 실제 0의 다른 개정 상태
옛 값새 값상태수치 차이
null3가용성 변경계산하지 않음
3null가용성 변경계산하지 않음
nullnull동일하게 미가용계산하지 않음
03수치값 변경3

Old A=null and new A=three is not a numerical rise from zero to three. Both copies have the key, but availability changed. Return that status together with an undefined numeric difference.

Three becoming null means the new copy no longer supplies a value; two nulls mean unchanged unavailability. Filling all three cases with zeros hides when values appeared or disappeared.

Unavailable values differ from actual zero
OldNewStatusNumeric difference
null3Availability changedNot computed
3nullAvailability changedNot computed
nullnullUnchanged unavailableNot computed
03Numeric value changed3
기초Foundations

29. 키의 추가·제거와 값의 변경을 나눈다29. Separate added/removed keys from changed values

옛 키가 {A,B}, 새 키가 {A,C}라면 A는 양쪽에 있고 B는 제거, C는 추가입니다. A의 값이 null에서 3으로 바뀌었다고 해 봅시다. 상태는 가용성 변경 하나·제거 하나·추가 하나로 합계 세 키입니다. 새 파일 길이 2와 옛 파일 길이 2가 같아도 같은 두 관측이 아닙니다.

엔진은 옛 목록 순서대로 키를 보여 준 뒤 새 목록에만 있는 키를 붙입니다. 이는 비교표를 읽기 위한 출력 순서입니다. 키의 실제 시간 순서나 중요도를 새로 정한 것은 아닙니다.

Old keys {A, B} and new keys {A, C} share A, remove B and add C. If A also changes from null to three, the three union keys receive availability-change, removed-key and added-key statuses. Two rows in each copy do not mean the same two observations.

The engine displays old keys in old order, followed by new-only keys. This is a readable comparison-table order, not a newly inferred chronological order or ranking.

기초Foundations

30. 한 사본에서 같은 의미 키가 두 번이면 먼저 멈춘다30. Stop when a copy repeats a supposedly unique key

옛 목록에 A=1과 A=2가 함께 있다면 “A의 옛 값”을 하나로 정할 수 없습니다. 처음 것을 쓸지 마지막 것을 쓸지 프로그램이 몰래 결정하면 비교 결과가 달라집니다. 이번 개정 API는 한 사본 안의 중복 키를 오류로 거절합니다.

자료에 반복 측정·여러 사람·여러 거래가 실제로 존재한다면 행을 지우기 전에 키 설계를 다시 봅니다. 연도만 쓴 키에 국가를 붙이거나, 관측 식별에 필요한 별도 원행 키를 유지할 수 있습니다. 같은 내용의 행이 있다는 사실과 같은 실제 대상을 다시 측정했다는 주장은 다릅니다.

실제 손글씨의 65개 수치 조합은 이번 보관본에서 모두 다릅니다. 그 사실을 이용해 원 파일의 행을 맞춘 것이지, 65개 수치를 사람의 영구 ID로 선언한 것이 아닙니다.

If an old copy contains both A=one and A=two, “the old value of A” is ambiguous. Silently choosing first or last changes the result. The revision API rejects duplicate semantic keys within either copy.

When repeated measurements, people or transactions are genuinely present, reconsider the key before deleting rows. A year key may need a country field, or a separate source-row key may be needed. Identical row content and repeated measurement of the same entity are different claims.

All 65-number digit tuples are unique in this retained snapshot. That supports its verified source-file row mapping, not a permanent person identifier.

심화Extension

31. 여섯 상태가 합집합을 나누는 이유31. Why the six revision statuses partition the union

고급 확인에서는 키 합집합을 하나씩 순회합니다. 한쪽에만 있으면 추가 또는 제거입니다. 양쪽에 있으면 두 값이 모두 null인지, 한쪽만 null인지, 둘 다 수치인지 나눕니다. 둘 다 수치일 때에만 정확 차이 0 여부를 검사합니다. 이 순서의 가지들은 서로 겹치지 않고 모든 키를 포함합니다.

K=Kold∪Knew∣K∣=Nadd+Nremove+Navailability+Nchanged+Nsame+Nunavailable\begin{gathered}K=K_{\rm old}\cup K_{\rm new}\\|K|=N_{\rm add}+N_{\rm remove}\\{}+N_{\rm availability}+N_{\rm changed}\\{}+N_{\rm same}+N_{\rm unavailable}\end{gathered}

상태 수의 합이 합집합 키 수와 같은지 검산합니다. 양쪽 키가 유일하며 비교하는 수치와 가용성이 모두 같으면 “선택한 수치 투영이 같다”고 보고할 수 있습니다. 순서·원문 바이트·선택하지 않은 단위 설명까지 자동으로 같다는 결론을 더하지 않습니다.

For an advanced check, visit each union key once. A key in only one copy is added or removed. Otherwise distinguish two nulls, exactly one null and two numeric values. Only the last case tests whether the exact difference is zero. These branches are disjoint and exhaustive.

K=Kold∪Knew∣K∣=Nadd+Nremove+Navailability+Nchanged+Nsame+Nunavailable\begin{gathered}K=K_{\rm old}\cup K_{\rm new}\\|K|=N_{\rm add}+N_{\rm remove}\\{}+N_{\rm availability}+N_{\rm changed}\\{}+N_{\rm same}+N_{\rm unavailable}\end{gathered}

Verify that status counts sum to the union-key count. With unique keys and equal compared values/availability, report equality of the selected numeric projection. Do not extend that conclusion to row order, raw bytes or unexamined unit descriptions.

기초Foundations

32. 실습 D · 순서·표현·가용성·수치를 따로 바꾼다32. Lab D · Change order, representation, availability and values separately

기본 옛 A=1·B=null과 새 B=2·A=1.0을 키로 맞춰 보세요. A는 수학적으로 같고 B는 가용성이 바뀝니다. 새 목록의 A를 먼저 놓아도 상태는 같습니다. A를 4/3으로 바꾸면 수치 차이 1/3이 생깁니다.

입력의 수치는 따옴표 안의 십진수·분수 문자열 또는 null입니다. 잘못된 JSON·중복 키가 들어오면 이전 비교표를 지우고 이유를 표시합니다. 실제 국가 값은 뒤에서 여섯 값 모두 차이가 0인 결과로 따로 읽습니다. 설명용 변경을 실제 자료 개정처럼 소개하지 않습니다.

Match default old A=one/B=null with new B=two/A=1.0. A is numerically unchanged; B changes availability. Reordering the new list leaves those statuses unchanged. Changing A to 4/3 gives numeric difference 1/3.

Values are quoted decimal/fraction strings or null. Clear the previous table on malformed JSON or duplicate keys. The actual country comparison later has six unchanged values. Toy modifications are not presented as observed source revisions.

기초Foundations

33. 연결 성공·문법 읽기·자료 검사는 세 단계다33. Transport, parsing and data checks are separate stages

설명용 서버가 HTTP 200과 함께 HTML 안내문을 돌려주었다고 합시다. 통신이 어떤 응답을 받았다는 사실과 원하는 JSON 자료가 들어 있다는 사실은 다릅니다. 안내문을 JSON으로 읽으려 하면 문법 단계에서 실패할 수 있습니다. JSON 객체로 읽었더라도 필요한 value 칸이 없으면 스키마 단계에서 다시 실패합니다.

성공을 한 단어로 합치지 않는 순서
단계묻는 질문설명용 결과
응답 상태어떤 HTTP 응답을 받았나?200과 HTML 본문
문법 읽기원하는 JSON 구조로 읽히나?실패할 수 있음
자료 약속필요한 칸·종류·키가 맞나?별도 확인

실제 UCI JSON 본문 안에도 "status":200이라는 칸이 있습니다. 이는 그 본문에 적힌 API 상태값입니다. 보관하지 않은 HTTP 헤더의 상태코드를 그 칸에서 새로 복원했다고 하지는 않습니다.

Suppose a toy server returns HTTP 200 with an HTML notice. Receiving a response differs from receiving the intended JSON data. Parsing the notice as JSON can fail. Even parsed JSON may lack required fields and fail the schema.

A staged meaning of success
StageQuestionToy result
Transport statusWhich HTTP response arrived?200 with HTML body
ParsingDoes it parse as the intended JSON?Can fail
Data contractAre required fields, kinds and keys present?Another check

The actual UCI JSON body also contains "status":200. That is an API status field in the retained body. It does not recover an unrecorded HTTP response-header status.

기초Foundations

34. 마지막 시도와 마지막 쓸 수 있는 답은 다르다34. The last attempt differs from the last usable reply

설명용 시도 세 개가 순서대로 503·JSON·스키마 실패, 200·JSON·스키마 성공, 200·HTML·스키마 성공이라는 메타데이터를 갖는다고 합시다. 이 실습이 선언한 선택 규칙은 “2xx 상태, JSON/CSV/XML 형식, 선언된 스키마 성공”입니다. 둘째 시도만 세 조건을 모두 만족합니다.

마지막 시도라는 이유로 셋째를 고르면 자료 형식 조건을 놓칩니다. 이 예에서는 마지막으로 규칙을 만족한 둘째 답을 선택하며 세 시도의 기록은 모두 남깁니다. 메타데이터의 스키마 성공 표시는 입력으로 주어진 값입니다. 실습 함수가 본문을 내려받아 실제 스키마 검사를 실행한 것처럼 표시하지 않습니다.

실제 수집 프로그램에서는 본문 읽기와 검사 결과를 먼저 계산하고 그 결과를 기록해야 합니다. 여기서는 그 기록을 어떻게 선택하는지 작은 모형으로 추적합니다.

Take three supplied toy attempts: 503/JSON/schema-failed, 200/JSON/schema-passed and 200/HTML/schema-passed. The declared rule requires a 2xx status, JSON/CSV/XML format and declared schema success. Only attempt two satisfies all three.

Choosing the final attempt would overlook the format condition. Select the latest attempt satisfying the rule while retaining all attempts. Schema success is supplied metadata here; the function does not fetch and validate a response body.

An actual collector must first compute parsing and validation results, then log them. The toy model isolates how such records are selected.

기초Foundations

35. 수집 기록표는 요청과 원 파일을 연결한다35. A manifest connects requests with retained files

실험 노트에 시약 이름과 사용 시간을 적듯이, 수집 기록표에는 요청 이름·정확한 URL·받은 날짜·파일명·바이트 수·해시를 적습니다. 이 연결표를 manifest라고 부르겠습니다. 파일명만 latest.json이면 나중에 어떤 기간·지표를 요청했는지 이름에서 알기 어렵습니다.

실제 여섯 파일의 기록표에는 URL·보관일·바이트·SHA-256이 있습니다. HTTP 상태·ETag·초 단위 시각은 그 표에 없습니다. 이미 없는 정보를 임의로 채워 넣지 않고 “기록하지 않음”으로 둡니다. 보관일이 하루 단위라면 초 단위 수집 순서도 그 날짜 하나로 알아내지 못합니다.

상대 파일 경로는 공개 묶음 안에서 원 파일을 찾게 해 줍니다. 원 파일과 비교를 거쳐 만든 CSV는 서로 다른 파일 역할입니다. 입력 출처를 적을 때 두 역할을 구분해 둡니다.

Like a laboratory notebook connecting materials and times, a collection manifest connects a request name and exact URL to retrieval date, filename, byte count and checksum. A name such as latest.json alone may not reveal the requested period or indicator.

The actual six-file manifest records URLs, dates, bytes and SHA-256. It does not retain HTTP statuses, ETags or second-level timestamps. Keep those fields unrecorded. A day-level date cannot supply a second-level attempt order.

Relative paths locate inputs within the public bundle. Raw replies and derived comparison CSVs play different roles; identify both when recording inputs.

기초Foundations

36. SHA-256으로 실제 파일 바이트를 다시 읽는다36. Read actual file bytes to compute SHA-256

SHA-256은 파일 바이트에서 256비트 요약을 계산합니다. 이를 16진수로 적으면 64자리입니다. Python에서는 바이너리로 읽은 바이트에 해시를 적용합니다. 다음 예는 공개 묶음의 루트에서 실행하며 파일의 수치를 다시 저장하지 않습니다.

from pathlib import Path
import hashlib
path = Path("data13-sources/source-wb-KOR-GDP2019-2024-page1.json")
raw = path.read_bytes()
print(len(raw))
print(hashlib.sha256(raw).hexdigest())

이 실제 파일은 773바이트이고 SHA-256은 34014b5948ad18e3330bf3075ac161ef868f44a3547fee6548c73c4e7deb582f입니다. 이 값은 본문을 받아 파싱한 객체가 아니라 원 바이트에서 계산했습니다. 라이브 manifest 실습의 입력 해시는 별도로 제공받은 문자이며 그 함수가 파일을 읽어 계산한 해시가 아닙니다.

SHA-256 summarizes bytes in 256 bits, conventionally written as 64 hexadecimal characters. Python can hash a binary read directly. Run this from the bundle root; it does not rewrite the numerical data.

from pathlib import Path
import hashlib
path = Path("data13-sources/source-wb-KOR-GDP2019-2024-page1.json")
raw = path.read_bytes()
print(len(raw))
print(hashlib.sha256(raw).hexdigest())

This actual file has 773 bytes and SHA-256 34014b5948ad18e3330bf3075ac161ef868f44a3547fee6548c73c4e7deb582f. It hashes original bytes rather than a parsed object. By contrast, the live manifest function audits supplied checksum text without reading a file.

기초Foundations

37. 다른 해시·같은 해시에서 말할 수 있는 것을 나눈다37. Separate what different and matching hashes imply

같은 SHA-256 함수를 같은 바이트에 적용하면 같은 요약이 나옵니다. 따라서 해시가 다르면 입력 바이트가 다릅니다. 그러나 같은 해시를 얻었다고 서로 다른 모든 바이트 입력을 수학적으로 배제한 것은 아닙니다. 33바이트 입력만 세어도 2²⁶⁴개이고 256비트 출력은 2²⁵⁶개라 여러 입력이 같은 출력으로 가는 경우는 존재합니다.

보관한 해시와 다시 읽은 해시의 일치는 사본을 점검하는 실용적 증거입니다. 해시가 자료원의 측정 정확도나 정당한 배포 주체를 스스로 확인하는 기능은 아닙니다. 비교할 원본 기록을 어디서 얻었는지도 함께 보관합니다.

값을 읽어 공백을 없앤 뒤 새 JSON을 저장하고 그 파일만 해시하면 원 응답 바이트를 확인한 것이 아닙니다. 원 바이트 해시와 정한 값 투영의 해시를 다른 이름으로 기록합니다.

Identical bytes passed to the same SHA-256 function produce the same digest, so different digests imply different bytes. Matching digests do not mathematically exclude every distinct input: even 33-byte inputs number 2²⁶⁴, exceeding 2²⁵⁶ outputs.

Agreement with a retained checksum is useful copy-checking evidence. The digest itself does not establish measurement accuracy or the identity of the distributor; retain where the comparison record came from.

Hashing newly serialized JSON after removing whitespace checks that new file, not the original reply. Name raw-byte and selected-value-projection hashes separately.

기초Foundations

38. R도 같은 원 파일에서 해시를 계산한다38. R hashes the same original file

기록된 R 4.5.1에서는 배포판의 tools::sha256sum을 사용할 수 있습니다. 아래 코드는 같은 첫 페이지 원 파일을 읽고 해시를 출력합니다. 없는 파일이라 해시가 NA이면 성공으로 넘기지 않습니다.

path <- "data13-sources/source-wb-KOR-GDP2019-2024-page1.json"
hash <- unname(tools::sha256sum(path))
stopifnot(!is.na(hash))
cat(hash, "\n")

정해진 실제 R 프로그램은 options(digits=17,warn=1)과 UTC 시간대 설정을 코드에 적고, Windows에서 문자 처리를 UTF-8 locale로 초기화합니다. 환경 기록에는 R 버전·설정·명령·작업 폴더·보조함수 해시가 있습니다. 화면 자릿수와 실제 계산값을 혼동하지 않도록 이 설정도 재현 경로에 넣습니다.

JSON 보조함수를 쓰는 R 예제는 data13-snippets/data13-json-reference.R도 함께 받아 묶음 루트에서 실행합니다. 프로그램 파일 하나만 다른 폴더로 옮겨 실행하는 경우와 필요한 입력·지원 파일을 보존한 실행은 다릅니다.

The recorded R 4.5.1 distribution provides tools::sha256sum. Hash the same first-page file and reject an unavailable checksum instead of treating NA as success.

path <- "data13-sources/source-wb-KOR-GDP2019-2024-page1.json"
hash <- unname(tools::sha256sum(path))
stopifnot(!is.na(hash))
cat(hash, "\n")

Actual fixed R programs declare options(digits=17,warn=1), UTC and a Windows UTF-8 character-locale initialization. Records include version, settings, command, working directory and helper checksum. Display options are part of reproduction even when underlying calculations agree.

R JSON examples also need data13-snippets/data13-json-reference.R. Run from the bundle root with required inputs/support files, rather than moving a single script into an unrelated directory.

기초Foundations

39. 보관본에서 처음부터 다시 실행한다39. Start a fresh execution from retained inputs

재현 순서를 작은 작업 목록으로 적어 봅시다. 먼저 요청 설정과 원 응답 파일을 찾습니다. 원 바이트·해시를 확인한 다음 문법을 읽고 칸의 약속을 검사합니다. 이어 유일 키·페이지 완결성·옛값과 새값의 상태를 확인하고 결과를 저장합니다.

새 프로세스는 이전 대화형 세션의 변수에 기대지 않습니다. 이 장의 34개 Python/R 고정 프로그램은 각각 새 프로세스로 실행했고, 잘못된 기간과 잘못된 JSON을 거절하는 네 실행도 실패 상태로 보관합니다. 성공 30개 중 26개에는 실제 SVG가 연결되고, 주소·숫자 토큰을 설명하는 나머지 네 개는 텍스트 결과를 남깁니다.

이 경로는 원래 온라인으로 받은 파일을 오프라인에서 다시 읽습니다. 같은 URL을 지금 다시 호출하면 서버가 바뀌어 다른 답을 줄 수 있습니다. 보관본 재현과 현재 서버 수집은 서로 다른 실행 목표입니다.

Write the procedure as concrete steps: locate request settings and raw replies; check bytes/checksums; parse and check field rules; inspect unique keys, page completeness and old/new states; save outputs.

A fresh process does not depend on variables in a previous interactive session. The 34 fixed Python/R programs were each actually run in a new process, including four honest failures for reversed periods or malformed JSON. Of 30 successful programs, 26 produce actual SVGs; four URL/number-token examples produce text results.

This path rereads replies originally collected online. Calling their URLs today could produce changed responses. Reproducing retained inputs and collecting from the current server are different execution goals.

기초Foundations

40. 실습 E · 쓸 수 있는 답을 골라도 이전 시도는 보관한다40. Lab E · Select a usable reply while retaining earlier attempts

설명용 manifest의 상태·형식·스키마 표시를 바꿔 보세요. HTTP 200·HTML을 JSON 성공 답으로 선택하지 않는지, 나중 시도가 실패해도 앞의 마지막 유효 답을 유지하는지 확인합니다. 요청 이름 두 개 중 하나만 기록하면 다른 이름은 “유효 답 없음”으로 남습니다.

이 라이브 패널은 제공한 메타데이터 규칙을 점검합니다. 실제 여섯 파일의 해시는 “보관 원 파일” Python/R 기록에서 별도로 확인합니다. 실제 기록에 없는 HTTP 상태를 성공 200으로 채우지 않으며, 날짜·파일 경로·해시의 원문도 함께 볼 수 있습니다.

Change toy status, format and schema flags. Check that 200/HTML is not chosen as a successful JSON reply, and that a later failed attempt leaves the earlier latest validated reply selected. Recording only one of two required request names leaves the other without a validated attempt.

This live panel audits supplied metadata. Use the separate archived-file Python/R records for actual six-file hashes. Unrecorded historical HTTP statuses remain unrecorded; inspect dates, paths and checksum text alongside the results.

기초Foundations

41. 실제 GDP 두 페이지의 여섯 관측을 맞춘다41. Match six GDP observations from two actual pages

실제 페이지 1의 GDP 값 세 개는 최신 쪽인 2024·2023·2022년에 해당합니다. 페이지 2에는 2021·2020·2019년이 있습니다. 첫 페이지만 평균하면 약 36,401.714617이고 여섯 값을 모두 쓰면 약 35,118.387474입니다. 이는 정해진 연도 집합 두 개의 기술 평균 비교입니다.

기존 보관 패널에서 같은 국가·연도·지표·단위의 여섯 값을 찾아 새 두 응답과 맞추면 저장 수치 차이는 모두 정확히 0입니다. 이번 여섯 관측에서는 수치 개정이 발견되지 않았습니다. 다른 나라·지표·기간까지 개정이 없었다는 주장을 추가하지 않습니다.

원문 십진 토큰·어느 페이지의 몇 번째 행이었는지·각 응답의 갱신일을 함께 둡니다. 날짜 순서 그래프는 관측 연도를 쓰며 수집 날짜를 관측 축으로 바꾸지 않습니다.

Actual page one contains 2024, 2023 and 2022; page two contains 2021, 2020 and 2019. The first-page mean is about 36,401.714617, compared with 35,118.387474 for all six. These describe two specified sets of years.

Matching the same six country/year/indicator/unit observations in the earlier retained panel gives six exact zero differences. No numeric revision was found for these six compared values; other countries, indicators or periods were not thereby checked.

Retain source decimal tokens, response-page positions and update fields. Plot observation years rather than replacing them with retrieval dates.

기초Foundations

42. 손글씨 원행 대응과 사람 ID를 구별한다42. Distinguish digit-record mapping from person identity

UCI 표준 CSV의 실제 5,620행은 64개 픽셀 열과 정답 열 하나를 갖습니다. 이번 사본에서 전체 65개 정수 조합은 모두 유일하며, 원 제공 훈련 3,823행·시험 1,797행의 값과 순서에 대응함을 확인했습니다. 표준 행 3,824는 원 optdigits.tes의 첫 행입니다.

원 설명은 훈련 작성자 30명과 서로 다른 시험 작성자 13명을 말합니다. 그러나 표준 CSV에는 작성자 ID나 원 훈련/시험 표시 열이 없습니다. 이번 수치 대응으로 복원한 파일 키와 원문 설명을 함께 보존하며, 각 행을 서로 다른 한 사람이라고 부르지 않습니다.

실습의 source row 선택은 이번 보관 표준 사본의 위치를 고릅니다. 후속 버전도 영원히 같은 순서라는 가정은 하지 않습니다. 변수 역할과 단위를 보고하지 않은 65개 units 칸도 그대로 볼 수 있습니다.

The standardized UCI file has 5,620 rows, 64 pixel inputs and one target. Every 65-integer tuple is unique in this retained snapshot and matches the original provided 3,823 training and 1,797 test rows in value/order. Standard row 3,824 maps to the first row of optdigits.tes.

The original description reports 30 training writers and 13 distinct test writers. The standardized CSV has no writer-ID or original-split column. Retain both the verified file-key mapping and the source description; a row is not automatically a distinct person.

The source-row control selects a position in this retained standardized copy. It does not promise permanent ordering in later versions. Inspect roles and the 65 unreported unit fields as well.

기초Foundations

43. 고객 표 14열의 역할과 원 숫자를 보존한다43. Retain roles and source values for all fourteen customer fields

실제 고객 표는 3,150행·14열입니다. Feature 13개와 Target 1개이고 명시된 ID 열은 없습니다. 원 보관 CSV와 표준 CSV의 같은 원순서 44,100개 수치 칸을 대조한 결과 변경 수는 0입니다. 이 숫자는 행 위치의 대응 범위를 말하며 고객의 영구 정체성을 확인한 수가 아닙니다.

불만·이탈 조합의 네 셀은 불만 0/이탈 0부터 순서대로 2,614·295·41·200행입니다. 합은 3,150입니다. 메타데이터의 units 칸은 14개 모두 null이며, Charge Amount 코드를 확인된 통화 금액으로 바꾸어 읽지 않습니다.

원 설명의 입력 집계는 첫 9개월, 정답은 12번째 달입니다. 각 원행의 달력 날짜는 이 표로 정해지지 않습니다. 자료셋 메타데이터를 만든 날짜와 고객 행동의 달력 시점을 구분합니다.

The actual customer table has 3,150 rows and 14 fields: 13 Features, one Target and no declared ID. Comparing 44,100 numeric cells in corresponding original/standardized row positions found zero changes. That verifies this positional comparison, not permanent customer identity.

The complaint/churn cells, ordered (0, 0), (0, 1), (1, 0), (1, 1), contain 2,614, 295, 41 and 200 rows, summing to 3,150. All 14 unit fields are null; do not reinterpret Charge Amount codes as established currency amounts.

The source describes inputs aggregated over the first nine months and a month-12 target. Row-level calendar dates are unavailable. Dataset metadata dates do not supply those behavioral calendar dates.

기초Foundations

44. 여섯 원 파일·두 메타데이터·두 CSV의 연결을 읽는다44. Read the connections among six retained source files

실제 원 파일 여섯 개는 GDP 두 JSON 페이지, 손글씨·고객의 JSON 메타데이터 두 개, 두 표준 CSV입니다. GDP 페이지는 각각 773바이트이고 손글씨 CSV는 834,735바이트입니다. 파일 크기가 크다고 행이나 변수가 더 중요하다는 뜻은 아닙니다.

메타데이터에서 data_url이 표준 CSV 주소를 가리키는 흐름을 읽습니다. 실제 CSV 머리글을 변수 목록의 Feature·Target·ID 역할과 맞추어 보아야 원하는 표를 얻었는지 확인할 수 있습니다. 다운로드 하나로 메타데이터와 관측 표가 같은 객체가 되는 것은 아닙니다.

이 장의 기록에서 여섯 파일의 바이트와 해시를 각각 다시 확인했습니다. 온라인 수집 때의 HTTP 헤더를 보관했다는 주장은 없으며, 오프라인 재실행이 온라인 수집을 다시 수행한 것으로 표시되지 않습니다.

The six raw files are two GDP JSON pages, digit/customer JSON metadata and two standardized CSVs. Each GDP page has 773 bytes; the digit CSV has 834,735. A larger file is not automatically a more important observation or variable.

Follow the metadata data_url into its CSV, then compare actual headers with declared Feature/Target/ID roles. Metadata and observation tables remain distinct objects.

The recorded programs recompute each file’s bytes and digest. They do not claim retention of historical HTTP headers or a fresh online collection.

심화Extension

45. 같은 값 투영이면 결정적 후속 계산도 같다45. Equal projections preserve deterministic downstream calculations

심화 연결로 D를 원 응답 전체, C(D)를 정한 키·값·가용성을 골라 키 순서로 놓은 표라고 합시다. 두 사본에서 C(D₁)=C(D₂)이고 같은 결정적 함수 T를 적용하면 T(C(D₁))=T(C(D₂))입니다. 입력이 같으면 같은 함수의 출력도 같다는 성질을 수집 재현에 적용한 것입니다.

C(D1)=C(D2)T(C(D1))=T(C(D2))\begin{gathered}C(D_1)=C(D_2)\\T(C(D_1))=T(C(D_2))\end{gathered}

역방향은 일반적으로 성립하지 않습니다. 두 값 목록 [10,30]과 [0,40]은 평균 T가 모두 20이지만 목록은 다릅니다. 계산 결과 하나만 같은 것을 모든 관측이 같았다는 점검으로 쓰지 않습니다.

C 자체도 원문 정보를 줄입니다. 숫자 표현 1과 1.0, 다른 줄바꿈이 같은 수치 표로 갈 수 있습니다. 원 응답·정한 투영·후속 통계라는 세 층을 기록하면 어느 층의 같음을 검증했는지 분명해집니다.

For an advanced connection, let D be the complete raw reply and C(D) the chosen keys, values and availability sorted by key. If C(D₁)=C(D₂), the same deterministic function T gives equal outputs. This is ordinary function substitution applied to reproducibility.

C(D1)=C(D2)T(C(D1))=T(C(D2))\begin{gathered}C(D_1)=C(D_2)\\T(C(D_1))=T(C(D_2))\end{gathered}

The reverse need not hold: lists [10, 30] and [0, 40] both average 20 while differing as lists. A matching final statistic does not establish matching observations.

C can itself discard textual information: one and 1.0, or different newlines, can map to the same numeric table. Record raw replies, selected projections and downstream statistics as three distinct layers.

기초Foundations

46. 실습 F · 실제 페이지·변수·원행을 고른다46. Lab F · Select actual pages, fields and source rows

국가를 선택해 첫 페이지만, 두 페이지 모두, 첫 페이지 반복을 비교합니다. 실제 원행을 새 관측으로 만들지 않고 받은 목록의 중복과 누락을 보여 줍니다. 여섯 값 전체의 과거/새 사본 비교는 보관한 두 페이지 전체에 대한 별도 표입니다.

손글씨에서는 변수 위치 1–65와 표준 원행 1–5,620을 고릅니다. 표준 원행 3,823과 3,824에서 원 훈련 파일 끝·시험 파일 처음의 대응을 확인합니다. 고객에서는 14개 변수의 이름·역할·보고된 종류·단위 상태를 읽습니다.

라이브 선택은 JavaScript의 보관 자료 조회입니다. 아래 Python/R 기록은 정해진 전체 예제를 실제 실행한 결과이며, 선택한 새 원행을 Python/R이 방금 실행한 결과라고 표시하지 않습니다. 코드 미리보기·동일 파일 다운로드·지원 파일 경로와 원 입력 해시를 함께 제공합니다.

For country, compare first page only, both pages and a repeated first page. Repeated received rows are not new observations. A separate retained full-two-page table compares all six old/new values.

For digits, choose schema position one through 65 and standardized source row one through 5,620. Rows 3,823/3,824 straddle the original training-file end and test-file start. For customers, inspect 14 names, roles, reported kinds and unit availability.

Live selections query retained data in JavaScript. Python/R records are actual executions of fixed full examples, not fresh Python/R executions of the newly selected row. Inspect exact code previews/downloads, support paths and input hashes.

기초Foundations

47. 공식 원 응답에서 계산까지의 전체 사례47. Complete cases from official retained replies to calculations

국가 사례 · 응답 한 번이 요청한 자료 전체일까?

World Bank 공식 API에 한국의 2019~2024년 1인당 실질 GDP를 요청했습니다. 국가 KOR, 지표 NY.GDP.PCAP.KD, 자료원 2, 날짜 범위 2019:2024, JSON 형식은 고정하고, 페이지당 3행으로 나눴습니다. 실제 응답 두 개를 2026년 10월 26일 내려받아 원 바이트와 URL·해시를 보관했습니다. 단위는 2015년 불변 USD/명이며 PPP나 개인 임금이 아닙니다. 이 작은 요청은 페이지 누락을 눈으로 확인하기 위한 실제 수집 실습입니다.

실제로 받은 페이지 메타데이터
요청 페이지응답 pagepagesper_pagetotal실제 이번 행누적 행
1123633
2223636

첫 페이지에는 2024·2023·2022년만 있습니다. 네트워크 요청이 성공하고 JSON을 읽었다는 사실만으로 2019~2024년 전체가 모인 것은 아닙니다. 응답이 알린 pages=2와 total=6을 확인하고 둘째 페이지를 받은 뒤, (국가·지표·연도) 키가 중복 없이 6개인지 검사해야 합니다. 행의 반환 순서를 연도 오름차순이나 미래에도 고정되는 규칙으로 추측하지 않습니다. 원 응답의 페이지·행 위치는 남기고 분석용 정렬을 따로 합니다.

같은 의미 키를 가진 이전 사본과 새 응답의 실제 값 · 소수 반올림
연도이전 사본 GDP/명새 응답 GDP/명새 응답 페이지값이 바뀌었나?
201933,496.31133,496.3112아니오
202033,215.93033,215.9302아니오
202134,792.94034,792.9402아니오
202235,809.01435,809.0141아니오
202336,347.70436,347.7041아니오
202437,048.42637,048.4261아니오

이전 큰 API 사본은 10월 20일에 보관했고 새 두 페이지는 10월 26일에 보관했습니다. 이번 선택 6개 값은 모두 같고 source lastupdated도 2026-10-08로 같습니다. 수집일이 달라졌다고 가짜 수정값을 만들지 않습니다. 반대로 이번에 같았다는 사실이 다른 지표·다른 시점이나 미래 수정 가능성까지 같다고 보장하지도 않습니다. 관측 연도, 기관의 갱신일, 실제 공개 시점, 다운로드일은 서로 다른 시간 정보입니다. lastupdated만으로 각 값이 역사적으로 언제 처음 알려졌는지 복원할 수 없습니다.

파일 해시와 의미 비교도 다릅니다. 이전 파일은 더 큰 국가·지표 범위를, 새 파일은 두 페이지를 담으므로 원 파일들의 SHA-256은 다릅니다. 이번에는 같은 여섯 의미 키·값만 같은 순서와 숫자 표현으로 정규화한 분석용 투영을 따로 만들었고 그 해시는 같습니다. 이것은 선택한 여섯 값의 동일성을 확인한 것이지 원문 전체·메타데이터가 모두 같다는 증명이 아닙니다. 원 바이트 해시도 별도로 계속 보존합니다.

먼저 생각한 뒤 풀이 보기: 첫 페이지 3행만 평균내도 6년 평균이라고 해도 되나요?

아닙니다. 첫 페이지는 최근 3년이고, 요청한 6년의 절반만 모인 것입니다. 이번 실제 값에서 최근 3년 평균과 여섯 해 평균을 각각 계산해 보세요. 빠진 페이지는 결측 관측이나 0이 아니며, 아직 수집하지 않은 응답입니다. 요청 범위·완료 조건을 충족하기 전에는 결과를 6년 요약이라고 붙이지 않습니다.

먼저 생각한 뒤 풀이 보기: 재현 코드를 실행할 때 API를 매번 다시 불러야 하나요?

보관된 결과를 재현하려면 당시의 원 응답을 읽습니다. 새 수집을 원하면 별도 실행으로 URL·시간·상태·원본을 새로 남기고 같은 의미 키를 대조합니다. 이 장의 동반 코드는 실제 보관된 원 응답을 오프라인으로 읽으며, 실행 중 조용히 최신 값으로 교체하지 않습니다.

사람의 필기 기록 · 같은 숫자를 받아도 원래 실험의 경계는 따로 남겨야 한다

UCI의 실제 dataset 80 메타데이터 API는 5,620기록, 64입력 특성, class라는 1개 정답 열을 알려 줍니다. 응답 안 data_url이 가리킨 공식 표준 CSV도 실제 내려받았습니다. 65열을 모두 읽고, 앞서 보관한 원 ZIP의 optdigits.tra 3,823행과 optdigits.tes 1,797행의 정수 65개씩을 직접 비교했습니다. 메타데이터를 받았다는 사실과 실제 데이터 파일의 행·열을 확인했다는 사실은 각각 따로 기록합니다.

이번 표준 CSV의 365,300개 수치는 원 학습 파일을 먼저, 원 테스트 파일을 뒤에 이은 값·순서와 모두 같습니다. 65개 수치를 함께 비교했을 때 이번 사본의 전체 기록은 모두 고유해 표준 CSV의 각 행을 원 파일·행으로 모호함 없이 대응시킬 수 있었습니다. 이 대응은 실제 비교를 한 이번 사본에 대한 결과입니다. 새 버전에서도 행 순서가 영원히 같다고 약속하거나 숫자 튜플을 실제 사람의 식별자로 바꾸지 않습니다.

실제로 검증한 표준 행과 원 파일의 대응
표준 CSV 행원 파일원 파일 안 행실제 숫자 분류65수치 일치 원행 수
1optdigits.tra101
3823optdigits.tra382371
3824optdigits.tes101
5620optdigits.tes179781
원 실험의 분할 맥락을 함께 복원
원 분할원 기록 수현재 표준 CSV의 검증 대응원 설명의 작성자 수
train3823382330
test1797179713

표준 CSV에는 원 분할 열도 작성자 ID 열도 없습니다. 원 메타데이터의 설명은 학습 30명과 그들과 다른 테스트 13명의 필기라고 하지만 행별 작성자 키는 알려 주지 않습니다. 따라서 숫자 5,620행을 다시 무작위로 나눴다고 같은 새 작성자 평가가 되는 것은 아닙니다. API의 index_col=null도 실제 사람을 식별하는 원 ID가 이 표에 선언돼 있지 않다는 뜻으로 읽어야 합니다. 메타데이터의 dataset 생성 연도 1998이나 갱신일 2023-08-23이 모든 사람이 그날 글씨를 쓴 시점이라는 뜻도 아닙니다.

먼저 생각한 뒤 풀이 보기: Attribute1~Attribute64라는 열 이름만 보고 의미를 알 수 있나요?

이름·정수형 선언만으로는 부족합니다. 원 설명을 함께 읽어 각 값이 8×8로 배열된 블록의 0~16 잉크 개수임을 확인합니다. class는 분류표이지 연속 길이나 양이 아닙니다. 데이터 사전에 열 순서·블록 배열·정답 역할·원 분할·출처를 함께 남겨야 합니다.

먼저 생각한 뒤 풀이 보기: 해시가 다른데 수치가 같다면 어떤 기록을 남겨야 하나요?

CSV·ZIP의 원 파일 해시와 형식, 열 이름·순서, 숫자 셀 비교 방법·범위, 원 파일/행 대응 결과를 나눠 남깁니다. 압축·헤더·줄바꿈 같은 표현 차이가 있다고 값이 수정된 것은 아닙니다. 반대로 일부 열만 같은 것이 전체 기록 동일성을 보장하지는 않아 이번에는 65개 모두를 확인했습니다.

고객 실무 사례 · API 사전의 빈 단위와 ID 선언을 실제 표와 대조하기

UCI Iranian Churn dataset 563의 실제 메타데이터와 그 data_url의 공식 CSV를 받았습니다. 응답은 기록 3,150개와 입력 13개를 알리고, 변수 목록에는 별도로 Churn 정답 1개가 있습니다. 그러므로 실제 표는 14열입니다. 입력 13개라는 말을 “CSV에 13열만 있어야 한다”로 읽으면 안 됩니다. 원 ZIP의 3,150×14개 수치를 같은 원행·열 이름으로 다시 읽어 표준 CSV의 44,100개 값과 전부 같음을 확인했습니다.

실제 API의 열별 역할 · unit 빈칸은 미기재
원 열 이름API 역할API 열별 형식unit 필드실제 확인할 의미
ComplainsFeatureBinary미기재불만 여부 0/1
Charge AmountFeatureInteger미기재서열 코드 0~9, 통화 아님
Subscription LengthFeatureInteger미기재원 설명의 개월 수
Seconds of UseFeatureInteger미기재원 설명의 통화 초 수
Customer ValueFeatureContinuous미기재계산 값, 통화 단위 미확인
ChurnTargetBinary미기재이탈 여부 0/1 정답

unit 필드가 null이라고 측정값 0으로 바꾸지 않습니다. 사전의 빈 필드와 원 설명을 구별하세요. 일부 변수의 개월·초 의미는 원 설명에서 확인할 수 있지만, Charge Amount는 0~9 서열 코드이고 Customer Value의 통화는 확인되지 않았습니다. 메타데이터의 넓은 feature_types 요약이 Integer라고 적혀 있어도 Customer Value의 열별 형식은 Continuous이며 실제 소수도 있습니다. 열별 사전과 실제 값까지 대조해야 합니다.

원 설명에 Anonymous Customer ID라는 말이 등장하지만, 실제 변수 목록·표준 CSV·원 표의 14열에는 고객 ID 열이 없고 API index_col도 null입니다. 여기서 source_row_id는 보관 위치를 추적하려고 붙인 행 키입니다. 실제 고객 신원을 안다거나 같은 사람이 다른 파일에서 다시 나왔는지 확인했다는 뜻이 아닙니다. 첫 열 Call Failure를 임의로 ID로 지정하지 않습니다.

수집·사전 검증 뒤 실제 기록의 네 칸을 다시 계산
불만 코드이탈 코드실제 기록 수전체 분모
0026143150
012953150
10413150
112003150

변수들의 시간도 사전에 남깁니다. 원 설명은 입력이 첫 9개월 집계이고 이탈은 12개월 말 상태이며 계획 간격이 3개월이라고 합니다. 달력상의 실제 어느 연도인지까지 제공하지는 않습니다. dataset 생성 연도 2020, 메타데이터 갱신일 2024-03-09, 이번 다운로드일 2026-10-26을 실제 고객 측정 연도로 바꾸지 않습니다. 미래 배포에서 같은 입력이 같은 시점까지 가용한지도 별도로 확인해야 합니다.

먼저 생각한 뒤 풀이 보기: 메타데이터의 has_missing_values=no이면 값·단위를 다시 볼 필요가 없나요?

아닙니다. 이번 실제 CSV에서 빈 수치가 없는지도 직접 확인했습니다. 그러나 결측 없음은 단위가 알려졌음, ID가 있음, 독립 표본임, 한국 고객을 대표함, 배포 시점에 가용함을 뜻하지 않습니다. 여러 다른 조건을 하나의 플래그로 대신하지 않습니다.

먼저 생각한 뒤 풀이 보기: 다음 다운로드에서 값이 달라지면 기존 분석 파일을 덮어써도 되나요?

새 원본·요청·응답·해시를 별도 보관하고 같은 열·의미 키·가용성을 대조합니다. 이 자료처럼 실제 고객 ID가 없으면 행 위치가 바뀐 두 버전을 함부로 개인별 변화로 해석하지 않습니다. 표현·정렬 변화인지, 측정 수정인지, 새 관측 추가인지 확인하고 새 결과를 기존 결과와 구분합니다.

Country case · Is one response the entire requested dataset?

We requested Korea’s 2019–2024 GDP per capita from the official World Bank API: country KOR, indicator NY.GDP.PCAP.KD, source 2, date range 2019:2024 and JSON format, with three rows per page. We downloaded and preserved both actual responses on October 26, 2026, including original bytes, URLs and hashes. The unit is constant 2015 USD per person, not PPP or an individual wage. This small real collection makes pagination omissions visible.

Metadata in the actual responses
Requested pageResponse pagepagesper_pagetotalRows returnedCumulative rows
1123633
2223636

Page 1 contains only 2024, 2023 and 2022. Successful transport and JSON parsing do not establish coverage of all six requested years. Inspect pages=2 and total=6, retrieve page 2 and verify six unique country/indicator/year keys. Do not assume ascending or permanently fixed response order. Preserve original page/row positions separately from analysis sorting.

Actual values on matching semantic keys · displayed decimals rounded
YearEarlier snapshot GDP/personNew response GDP/personNew pageValue changed?
201933,496.31133,496.3112No
202033,215.93033,215.9302No
202134,792.94034,792.9402No
202235,809.01435,809.0141No
202336,347.70436,347.7041No
202437,048.42637,048.4261No

The earlier broad API snapshot was retained on October 20 and the two new pages on October 26. All six selected values match; both source headers say lastupdated 2026-10-08. A new retrieval date is not an invented numerical revision. Conversely, equality here does not establish equality for every indicator, period or future revision. Observation year, publisher update date, actual release time and download date are distinct; lastupdated alone cannot reconstruct when each historical value first became known.

Byte hashes and semantic comparisons differ. The broad earlier file and two new page files have different scopes and different byte hashes. Separately normalize the same six semantic keys/values to a fixed order and numeric representation; these analysis projections have equal hashes. That verifies the selected values, not equality of every source byte or metadata field. Retain original byte hashes as well.

Think first, then reveal: May the first three returned rows be reported as the six-year mean?

No. They are the latest three years, only half the requested records. Calculate both means from the actual values. An uncollected page is neither a missing measurement nor zero; collection is incomplete. Do not label the result as a six-year summary before satisfying the declared scope/completeness checks.

Think first, then reveal: Must reproduction call the live API every time?

To reproduce a retained result, read its archived responses. A fresh collection is a separate run with new request/time/status/source records and semantic comparisons. The companion reads the actual archived responses offline; it does not silently replace them with current values.

Human handwriting records · Equal numbers do not replace original experimental boundaries

The actual UCI dataset 80 metadata response reports 5,620 records, 64 input features and one target column named class. We downloaded the official standardized CSV from the response’s data_url. We read all 65 columns and compared every integer with the retained ZIP’s 3,823 optdigits.tra and 1,797 optdigits.tes records. Receiving metadata and validating the data file’s actual rows/columns are separate checks.

In this snapshot, all 365,300 numeric cells match the original training file followed by the original test file, including order. Full 65-number records are unique here, allowing an unambiguous mapping back to original file/row keys. This is a verified property of this snapshot, not a perpetual ordering guarantee or a real person identifier.

Actual verified standardized-to-original mapping
Standard CSV rowOriginal fileRow within original fileActual classMatching full-65 source rows
1optdigits.tra101
3823optdigits.tra382371
3824optdigits.tes101
5620optdigits.tes179781
Retain original experimental partition context
Original splitOriginal recordsVerified current standard-CSV mappingWriters reported in source metadata
train3823382330
test1797179713

The standardized CSV contains neither the original split column nor a writer-ID column. Source text reports 30 training writers and 13 different test writers, without per-row writer keys. Randomly repartitioning the 5,620 records therefore does not recreate the same new-writer evaluation. The API’s index_col=null does not declare a real person identifier in this table. Its dataset-creation year 1998 and update date August 23, 2023 are not the dates on which every person wrote a digit.

Think first, then reveal: Do names Attribute1–Attribute64 establish the feature meanings?

Names and integer-type declarations are insufficient. Read the source explanation: values are 0–16 ink counts arranged in 8×8 blocks. class is a category, not a continuous amount. Retain feature order, block arrangement, target role, original split and provenance in the dictionary.

Think first, then reveal: What should be recorded when file hashes differ but numeric data match?

Retain original CSV/ZIP hashes and formats, column names/order, comparison scope/method and verified file/row mappings. Compression, headers or line endings can change bytes without changing measurements. Matching only some columns is weaker; here every one of the 65 fields was checked.

Customer practice case · Compare API units and identity declarations with the actual table

We retrieved the actual metadata for UCI Iranian Churn dataset 563 and the official CSV at its data_url. Metadata reports 3,150 records and 13 features, with one additional target, Churn, in the variable list. The table thus has 14 columns; 13 input features does not mean a 13-column CSV. We reread the retained ZIP and verified all 44,100 standardized numeric cells on corresponding source rows and names.

Actual per-variable API roles · blank unit fields are unreported
Source nameAPI rolePer-variable typeUnit fieldMeaning requiring source context
ComplainsFeatureBinaryUnreportedComplaint flag 0/1
Charge AmountFeatureIntegerUnreportedOrdinal code 0–9, not currency
Subscription LengthFeatureIntegerUnreportedMonths in source description
Seconds of UseFeatureIntegerUnreportedCall seconds in source description
Customer ValueFeatureContinuousUnreportedCalculated value, currency unestablished
ChurnTargetBinaryUnreportedChurn target 0/1

Do not replace a null units field with a measured zero. An empty metadata field differs from source explanatory text. That text supplies months/seconds for some variables, but Charge Amount is an ordinal code and Customer Value’s currency is unestablished. Even though the broad feature_types summary lists Integer, the per-variable Customer Value type is Continuous and actual decimal values exist. Check per-column metadata and observations.

Source explanatory text mentions Anonymous Customer ID, but the actual 14-column variable list, standardized CSV and original table do not contain a customer-ID column; API index_col is null. Our source_row_id traces a retained record position. It does not identify a customer or link the same person across files. Do not invent an ID by repurposing the first column, Call Failure.

Recompute four actual count cells after collection/schema checks
Complaint codeChurn codeActual recordsTotal denominator
0026143150
012953150
10413150
112003150

Retain temporal context too: source text describes inputs aggregated over the first nine months, a churn state at month 12 and a three-month planning gap. It does not establish the observation’s calendar year. Dataset-creation year 2020, metadata update March 9, 2024 and retrieval October 26, 2026 must not be substituted for a measured customer year. Future deployment also requires checking that inputs are available by the stated decision time.

Think first, then reveal: Does has_missing_values=no eliminate the need to inspect values and units?

No. Check that the actual CSV has no unavailable numeric cells, as done here. Completeness does not establish units, IDs, independence, representation of Korean customers or decision-time availability. One metadata flag does not certify these different conditions.

Think first, then reveal: May a later download silently overwrite the earlier analysis when values differ?

Retain the new source/request/response/hash separately and compare column meanings, semantic keys and availability. Without customer IDs, changed row positions across versions are not individual changes. Distinguish serialization/order changes, measurement revisions and added observations; label new results separately from old ones.

기초Foundations

48. 문서에서 필요한 부분을 직접 찾아 읽는다48. Read the specific documentation needed for each step

World Bank API 문서의 date·format·page·per_page와 응답·정렬 제한 부분을 실제 두 주소와 맞춥니다. 콜론의 기간과 페이지 크기를 구별하는 것이 첫 목표입니다.

Python JSON 문서에서는 load/loads, parse_int·parse_float, object_pairs_hook와 중복 이름 처리 부분을 읽습니다. 이 장의 NumberText와 중복 이름 거절은 그 지점에 연결한 명시적 선택입니다.

R tools의 sha256sum 문서에서는 파일/원 바이트 입력과 반환값을 확인합니다. 실제 지원 버전은 기록된 R 4.5.1로 직접 실행해 확인했습니다. RFC 8259의 객체·배열·숫자·문자열을 읽어 JSON 문법과 개별 reader의 지원 한계를 구분합니다.

UCI 공식 fetch.py는 메타데이터→data_url→변수 역할 분리 흐름만 읽습니다. 해당 패키지를 설치·실행한 기록으로 대신하지 않습니다.

본문 연결 영상은 Harvard CS50P API Calls의 문서·요청·JSON 흐름입니다. W3C의 Tim Berners-Lee 소개에서는 1989년 웹 구상과 URI·HTTP·HTML의 연결 역할을 읽습니다. 자료를 연결하는 기술과 연결한 관측의 의미 점검을 함께 생각해 보세요.

Python · R · 원자료·단위·가공·출처

Match the date, format, page and per_page sections and response/ordering limitations in the World Bank API documentation with the two retained request addresses.

Read load/loads, parse_int/parse_float, object_pairs_hook and duplicate-name handling in the Python JSON documentation. The chapter’s NumberText and duplicate-name rejection are explicit choices at those interfaces.

In R tools sha256sum documentation, check file/raw-byte inputs and returned digests. Availability was directly verified in recorded R 4.5.1. Read objects, arrays, numbers and strings in RFC 8259 to separate grammar from a reader’s declared limits.

Read only metadata → data_url → variable-role separation in official UCI fetch.py. This does not substitute for an execution record of that package.

The connected lesson is Harvard CS50P API Calls. In the W3C Tim Berners-Lee biography, read the 1989 origins and URI/HTTP/HTML connection. Consider both the technology connecting data and the meaning of connected observations.

Python · R · Inputs, units, transformations and sources

Python·R 코드 실행 방법Run the Python/R companions

자료 묶음을 풀고 코드와 실제데이터 폴더를 함께 두세요. 터미널에서 코드 파일이 있는 폴더로 이동해 아래 명령을 실행합니다. 코딩이 처음이라면 손계산과 웹 실습을 먼저 하고, 데이터 사이언스 입문에서 코드를 배운 뒤 돌아와도 됩니다.Extract the bundle, keeping the scripts beside the data folder. In a terminal, enter the script folder and run the commands below. Beginners can complete hand calculations and browser labs first, returning to code after studying introductory data science.

python data13-reproduce.py
Rscript --vanilla --encoding=UTF-8 data13-reproduce.R

결과 파일은 각 코드에 지정된 결과 폴더에 저장됩니다. CSV 원자료는 덮어쓰지 않습니다.Result files are saved in the result directory specified by each script; the input CSVs are not overwritten.

영상·학자·함께 읽기Videos, thinkers and guided reading

본문의 질문을 넓히는 선택 학습입니다. 영상을 보기 전 질문을 먼저 읽고, 자신의 답을 쓴 뒤 해설과 비교하세요. 자료의 언어·선수 지식은 각 항목에 표시했습니다.Optional extensions to the chapter. Read the question first, write your answer, then compare with the explanation. Language and prerequisites are indicated below.

Harvard CS50P · 문서·매개변수·JSON으로 API 읽기Harvard CS50P · Read APIs through documentation, parameters and JSON

Harvard CS50P Shorts · API Calls

문서에서 경로·매개변수·응답의 data를 찾는 순서를 보세요. 영상의 HTTP 상태 검사와 별개로 페이지 완결성·단위·관측기간은 직접 확인해야 합니다.Watch how documentation identifies routes, parameters and the response data. HTTP status handling does not replace checks of pagination, units or observation periods.

교재 안의 YouTube 플레이어에서 재생합니다. 원영상에서 제공하는 자막은 플레이어의 CC·설정에서 선택할 수 있습니다.Playback stays in this chapter’s YouTube player. Available captions can be selected through CC/settings.

보고 읽은 뒤 답하기Respond after watching/reading 응답200과 JSON읽기 성공이면 분석 자료도 완전한가요?Do response 200 and successful JSON parsing establish a complete analytical dataset?

생각을 점검하는 해설Check your reasoning

아닙니다. 요청 범위, 페이지, 유일 키, 스키마·결측·단위·시점을 추가로 검사합니다.No. Also check scope, pages, unique semantic keys, schema, missingness, units and timing.

팀 버너스리 · 연결되는 웹과 자료의 의미Tim Berners-Lee · A connected web and the meaning of data

W3C official biography

1989년 웹 구상과 URI·HTTP·HTML의 역할을 읽습니다. 자료를 연결할 기술과, 연결한 값의 측정·정체성·시점이 맞는지 판단하는 일은 서로 구별하세요.Read the account of the Web’s 1989 origins and URI/HTTP/HTML. Technologies that connect data do not themselves establish correct measurements, identity or timing.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 같은 URL에서 내려받았다는 사실이 같은 버전·같은 의미를 보증하나요?Does downloading from the same URL guarantee the same version and semantics?

생각을 점검하는 해설Check your reasoning

아닙니다. 수집 시점의 원 응답과 스키마·단위·키를 보관하고 비교해야 합니다.No. Retain and compare the response, schema, units and keys at retrieval time.

World Bank 공식 · 날짜 범위와 페이지 매개변수Official World Bank · Date ranges and pagination

Indicators API · Basic Call Structures, date/format/page/per_page sections

date·format·page·per_page의 뜻을 실제 두 요청과 맞춰 읽습니다. most recent nonempty나 gapfill을 쓸 때는 원래의 결측·기간이 바뀔 수 있으므로 자동으로 켜지 않습니다.Match date, format, page and per_page to the actual two requests. Most-recent-nonempty and gap-fill options can change missingness/period semantics; do not enable them silently.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading per_page=3이면 자료원에3개 기록만 있나요?Does per_page=3 mean the source has only three matching records?

생각을 점검하는 해설Check your reasoning

한 응답의 크기를 정한 것입니다. total과 pages, 실제 모은 유일 키 수를 함께 확인합니다.It sets one response’s size. Check total, pages and the unique keys actually collected.

UCI 공식 클라이언트 · 메타데이터와 실제 CSV를 나누어 읽기Official UCI client · Distinguish metadata from the data CSV

UCI-ML-Repo official fetch.py · endpoint/data_url/variable-role handling only

공식 클라이언트가 메타데이터를 받고 data_url을 읽은 뒤 열을 역할별로 나누는 흐름만 확인합니다. 이 장은 해당 패키지를 설치·실행했다고 주장하지 않으며 원 응답과 원 CSV를 독립으로 검증합니다.Read only the metadata → data_url → variable-role flow. This chapter does not claim execution of that package; it independently checks original responses and CSVs.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading num_features=13이면 정답·ID 열도 그 안에 자동 포함되나요?Does num_features=13 automatically include targets and IDs?

생각을 점검하는 해설Check your reasoning

아닙니다. 실제 변수 목록의 Feature·Target·ID 역할과 index_col, 실제 CSV 열을 대조해야 합니다.No. Inspect Feature/Target/ID roles, index_col and the actual CSV columns.

연습문제 · 계산에서 설명과 증명까지Exercises: calculation, explanation and proof

먼저 혼자 풀고 풀이를 여세요. 숫자와 함께 단위·포함 기준·계산 이유를 확인하세요.Attempt each problem before opening its solution. Check units, inclusion rules and the reason for the calculation.

1. 첫 세 장과 여섯 장First three versus all six

고정 카드 A–F의 값은 차례로 10·20·30·40·50·60입니다. 첫 페이지 A–C만 받았을 때와 모든 카드를 받았을 때의 평균을 각각 구하세요. 두 평균의 분모는 무엇인가요?

Fixed cards A–F carry 10, 20, 30, 40, 50 and 60. Find the mean using only page-one cards A–C and the mean using all six. Identify both denominators.

풀이와 확인할 이유Solution and explanation

첫 합은 60이므로 60/3=20입니다. 전체 합은 210이므로 210/6=35입니다. 분모는 각 계산에 실제 넣은 카드 수입니다. 첫 페이지 평균을 전체 여섯 카드 평균이라고 부르면 자료 범위가 달라집니다.

The first sum is 60, giving 60/3=20. The complete sum is 210, giving 210/6=35. Denominators count cards actually used; the first-page mean is not the six-card mean.

2. 양끝을 포함하는 연도Inclusive years

한 국가의 연간 지표에서 2021년부터 2024년까지 각 연도에 하나씩 후보 키를 기대합니다. 후보 수와 직접 적은 연도 목록을 쓰세요. 이 계산만으로 각 값의 가용성까지 알 수 있나요?

A single-country annual indicator expects one candidate key for every year from 2021 through 2024. List the years and count candidates. Does that establish availability?

풀이와 확인할 이유Solution and explanation

목록은 2021·2022·2023·2024이고 후보 수는 2024−2021+1=4입니다. 이는 요청 범위의 키 수입니다. 각 실제 값이 있는지는 받은 응답과 가용성 표시를 읽어야 합니다.

Years 2021, 2022, 2023 and 2024 give 2024−2021+1=4 candidates. That counts the requested key range; actual values require inspection of the reply.

3. 페이지 크기와 전체 수Page size and total

첫 페이지 답만 받았습니다. 이 답의 메타데이터는 page=1, pages=2, per_page=3, total=6이고 실제 관측 객체는 세 개입니다. 이번 답의 관측 수·전체 일치 행 수·남은 페이지 수를 구하세요.

Only this first-page reply has been received. It reports page=1, pages=2, per_page=3 and total=6, with three observation objects. Find rows in this reply, total matching rows and pages still unreceived.

풀이와 확인할 이유Solution and explanation

이번 답에는 3개, 전체 일치 행은 6개, 아직 받지 않은 페이지는 1개입니다. per_page는 한 응답의 크기 설정이며 total과 다른 칸입니다. 바깥 JSON 목록의 항목 수를 관측 수로 세지 않습니다.

There are three observations here, six matching rows overall and one remaining page. Page capacity and total are distinct fields; an outer JSON-array length is another quantity.

4. 세 날짜의 역할Three date roles

관측은 2024년이고 응답 lastupdated는 2026-10-08, 사본 보관일은 2026-10-26입니다. 관측기간·자료원 갱신 표시·수집 기록일을 구별하고 2024년 당시 공개값을 안다고 할 수 있는지 설명하세요.

Observation year is 2024, response lastupdated is 2026-10-08 and retrieval date is 2026-10-26. Identify the roles and whether the 2024 real-time public value is established.

풀이와 확인할 이유Solution and explanation

각각 2024년, 2026-10-08, 2026-10-26입니다. 2026년에 받은 사본의 수치는 2024년 당시의 공개 수치와 다를 수 있습니다. 과거 공개값을 확인하려면 해당 시점의 보관본이나 버전 기록이 더 필요합니다.

They are observation period, source update field and retrieval record, respectively. A 2026 copy alone does not establish what was publicly available during 2024; that requires a historical copy or version record.

5. 주소 문자열은 통신 결과인가A URL string is not an exchange

프로그램이 고정 base와 설정 문자열을 이어 url에 저장한 뒤 print(url)만 실행합니다. 네트워크 함수는 호출하지 않았습니다. 주소 출력 성공으로 HTTP 성공·자료 가용성을 결론낼 수 있나요?

A program joins a fixed base and query settings, stores url and runs only print(url). No networking function is called. Does successful printing establish HTTP success or data availability?

풀이와 확인할 이유Solution and explanation

없습니다. 성공한 것은 문자열 만들기와 출력입니다. 서버가 응답했는지, 기간에 해당하는 행이 있는지는 실행하지 않은 다른 단계입니다. 이 장 request API도 주소 만들기 범위를 반환합니다.

No. String construction and printing succeeded. Server response and record availability belong to other operations. The request API likewise reports construction rather than an HTTP exchange.

6. 뒤집힌 기간Reversed period

요청 규칙은 firstYear≤lastYear입니다. firstYear=2025, lastYear=2024를 넣었습니다. 연도 수를 0이라고 출력하고 성공으로 넘기는 대신 어떤 상태를 보여야 하나요?

The request rule requires firstYear≤lastYear, but inputs are 2025 and 2024. What should replace reporting zero candidate years as success?

풀이와 확인할 이유Solution and explanation

역전된 기간 입력 오류를 표시하고 이전 성공 결과를 지웁니다. 유효한 빈 자료 응답을 받은 것이 아닙니다. 설정 오류와 서버가 보고한 0행은 구별합니다.

Report an invalid reversed period and clear the previous successful result. No valid empty response was received. Invalid settings differ from a server reporting zero rows.

7. 일곱 행을 세 개씩Seven rows, three per page

고정된 서로 다른 키가 7개이고 한 페이지에는 최대 3개가 들어갑니다. 필요한 페이지 수와 각 페이지 행 수를 쓰세요.

Seven distinct fixed keys are partitioned into pages containing at most three each. Find page count and row counts by page.

풀이와 확인할 이유Solution and explanation

7/3의 올림은 3입니다. 첫째 3개·둘째 3개·셋째 1개입니다. 전체 7개를 보존하며 마지막 1개를 버리지 않습니다.

The ceiling of 7/3 is three. Pages contain three, three and one, preserving all seven keys.

8. 빈 설명용 서버의 약속Declared empty-server convention

이 문제의 빈 서버는 0행을 담은 page1이 있다고 약속합니다. 예상 키가 0개이고 page1을 받았을 때 페이지 수·행 수·키 완결성을 쓰세요. 모든 실제 API에도 같은 빈 응답을 강제할 수 있나요?

This toy empty server has page one containing zero rows. With zero expected keys and page one received, report page count, rows and key completeness. Must every actual API use this convention?

풀이와 확인할 이유Solution and explanation

이 약속에서는 1페이지·0행이며 예상 키가 모두 포함되어 완결합니다. 0행 평균은 여전히 정의되지 않습니다. 실제 API의 빈 응답은 문서와 실제 구조를 따로 확인합니다.

Under the stated convention there is one page, zero rows and a complete expected key set. A zero-row mean remains undefined. Actual APIs require their own empty-response rules.

9. 첫 페이지를 두 번Receiving page one twice

고정 페이지 1은 A·B·C, 페이지 2는 D·E·F입니다. 받은 페이지 목록이 [1,1]일 때 전송 행 수·유일 키 수·추가 반복 행 수·빠진 키를 구하세요.

Fixed page one contains A/B/C and page two D/E/F. For received pages [1, 1], find delivered rows, distinct keys, extra repetitions and missing keys.

풀이와 확인할 이유Solution and explanation

전송 목록 A·B·C·A·B·C는 6행, 유일 키는 3개, 추가 반복은 3행입니다. D·E·F는 없습니다. 전체 예상 수 6과 전송 행 수가 같아도 완결하지 않습니다.

A/B/C/A/B/C has six rows, three distinct keys and three extra repeated rows. D/E/F remain missing, so matching the expected row count six does not establish completeness.

10. 완결과 반복 없는 완결Complete versus uniquely complete

고정 페이지 1은 A·B·C, 페이지 2는 D·E·F이고 받은 목록은 [1,2,1]입니다. 완결 여부와 반복 없는 완결 여부를 각각 정하세요.

Fixed pages contain A/B/C and D/E/F. Received pages are [1, 2, 1]. Is the collection complete, and is it uniquely complete?

풀이와 확인할 이유Solution and explanation

9행을 받아 유일 키는 6개, 추가 반복은 3행입니다. 모든 페이지·키를 받았으므로 완결하지만 반복 없는 완결은 아닙니다. 두 표시는 다른 질문에 답합니다.

Nine delivered rows contain six distinct keys and three extras. All pages and keys arrived, so it is complete, but repetitions prevent a unique complete collection.

11. 실패한 두 번째 요청Failed second request

첫 페이지의 3행은 받았고 두 번째 페이지 요청은 실패했습니다. 다음 표를 6행으로 만들기 위해 빠진 세 value를 0으로 넣어도 되나요? 실패 기록에는 관측 본문이 없습니다.

Page one supplies three rows; the request for page two fails without an observation body. May three zero values be inserted to make a six-row table?

풀이와 확인할 이유Solution and explanation

안 됩니다. 받은 관측은 3행이고 나머지는 아직 받지 못했습니다. 실패 시도·미수신 페이지를 기록하고 재시도 결과를 나중에 연결할 수 있습니다. 0이라는 관측 세 개를 만들어 넣지 않습니다.

No. Three observations were received and the remainder were not. Log the failed attempt and missing page; connect a later retry if one occurs. Do not create measured zeros.

12. 순서를 뒤집은 두 페이지Reversing delivery order

페이지 1은 A·B·C, 페이지 2는 D·E·F입니다. [1,2]와 [2,1]의 전송 순서·유일 키 집합·완결성이 어떻게 다른가요?

Pages contain A/B/C and D/E/F. Compare [1, 2] with [2, 1] in delivered order, distinct key set and completeness.

풀이와 확인할 이유Solution and explanation

전송 순서는 ABCDEF와 DEFABC입니다. 유일 키 집합은 둘 다 {A,B,C,D,E,F}이고 완결합니다. 행 순서와 키 집합은 다른 비교이며 원 전송 순서를 보존할 수 있습니다.

Orders are ABCDEF and DEFABC. Both have the same six-key union and are complete. Retain delivery order while distinguishing it from set equality.

13. 두 키의 반복 가중 평균Multiplicity-weighted mean

고정 키 A·B의 값은 0·8이고 반복수는 mA=3,mB=1입니다. 키 균등 평균과 받은 행 평균을 구하세요. 모든 원값은 가용합니다.

Fixed keys A/B have available values zero/eight and multiplicities three/one. Find the uniform-key mean and delivered-row mean.

풀이와 확인할 이유Solution and explanation

키 평균은 (0+8)/2=4입니다. 받은 값은 0·0·0·8이므로 8/4=2입니다. 값 0이 세 번 들어가 무게가 커졌으며 평균 차이는 −2입니다.

The key mean is four; delivered values zero/zero/zero/eight average two. Extra weight on zero changes the mean by −2.

14. 받은 행이 0개인 평균Mean of zero received rows

예상 키 A·B·C는 있지만 성공한 응답을 하나도 받지 않아 받은 행 수 M=0입니다. 받은 행 평균을 0으로 출력할 수 있나요? 완결성과 분모를 함께 설명하세요.

Expected keys A/B/C exist, but no successful response arrived, so M=0. May the delivered-row mean be reported as zero? Explain denominator and completeness.

풀이와 확인할 이유Solution and explanation

평균의 분모 M이 0이므로 이 평균은 정의되지 않습니다. 값이 모두 0인 세 관측을 받은 것과 다릅니다. 예상 세 키도 모두 빠져 있어 완결하지 않습니다.

No: the mean denominator is zero. This is not receiving three measured zeros. All three expected keys are missing and collection is incomplete.

15. 개수는 같지만 키는 다르다Equal counts, different keys

예상 키는 {A,B,C,D,E,F}, 실제 받은 키는 {A,B,C,D,E,X}이고 각 키는 한 번씩 나타납니다. 개수 검사를 넘어 어떤 두 목록을 보고해야 하나요?

Expected keys are {A, B, C, D, E, F}; received distinct keys are {A, B, C, D, E, X}. Which two lists should supplement a count check?

풀이와 확인할 이유Solution and explanation

예상 중 없는 키는 {F}, 예상 밖 추가 키는 {X}입니다. 두 목록 크기는 모두 6이지만 집합은 다릅니다. 예상 키 누락과 뜻이 다른 행의 유입을 따로 보여 줍니다.

Report missing expected key {F} and unexpected key {X}. Equal counts six do not imply equal sets.

16. 페이지 사이의 메타데이터 불일치Metadata changing between pages

첫 답은 total=6,pages=2라고 했고 다음 답은 total=7,pages=3이라고 합니다. 두 답을 하나의 고정된 여섯 행 사본이라고 바로 합쳐도 되나요?

One reply says total=6, pages=2; the next says total=7, pages=3. May they immediately be treated as one fixed six-row snapshot?

풀이와 확인할 이유Solution and explanation

바로 그렇게 가정하지 않습니다. 요청 설정·갱신 정보와 원 답을 보존하고 서버 자료나 범위가 바뀌었는지 확인합니다. 두 답을 받은 사실만으로 하나의 원자적 스냅숏에서 왔다고 증명되지 않습니다.

No. Retain requests and replies, compare update fields and investigate changed scope or source content. Receiving both does not prove an atomic snapshot.

17. JSON의 두 층Two JSON layers

JSON이 [{"page":1,"pages":2},[{"key":"A"},{"key":"B"},{"key":"C"}]]입니다. 바깥 목록 길이와 실제 관측 목록 길이를 각각 구하세요.

For [{"page":1,"pages":2},[{"key":"A"},{"key":"B"},{"key":"C"}]], count outer items and observation-list items.

풀이와 확인할 이유Solution and explanation

바깥 길이는 2이고 관측 목록 길이는 3입니다. 첫 항목은 메타데이터 객체, 둘째 항목이 세 행 목록입니다. 바깥 길이를 관측 수로 읽지 않습니다.

There are two outer items and three observations inside the second. The first item is metadata.

18. get만 쓰면 합쳐지는 두 경우Two cases hidden by get

Python에서 a={"value":None},b={}입니다. a.get("value"),b.get("value")와 각 이름 존재 검사를 비교하세요.

Python objects are a={"value":None} and b={}. Compare their get("value") results with field-presence tests.

풀이와 확인할 이유Solution and explanation

get은 둘 다 None을 줍니다. 그러나 "value" in a는 True, "value" in b는 False입니다. 이 차이를 함께 보관해야 명시 null과 없는 필드를 구별합니다.

Both get calls return None. But "value" in a is True and "value" in b is False. Presence preserves the explicit-null/absent distinction.

19. 0·null·문자열 0Zero, null and quoted zero

세 JSON 값 0, null, "0"의 종류를 쓰세요. value는 필수 exact-number 문자열, null 허용이라는 규칙에서는 어느 것이 유효한가요?

Classify JSON 0, null and "0". The required value rule allows exact-number text or null. Which pass?

풀이와 확인할 이유Solution and explanation

각각 숫자·null·문자열입니다. 이 특정 규칙에는 null과 문자열 "0"이 유효하며 따옴표 없는 숫자 0은 수치 문자열 규칙을 어깁니다. 관측값 0의 의미를 부정한 것이 아니라 저장 종류의 계약을 점검한 것입니다.

They are a number, null and a string. This rule accepts null and quoted numeric zero; unquoted zero violates its text requirement. That checks representation, not whether a measured zero is meaningful.

20. 큰 정수의 두 표현Two representations of a large integer

원 JSON 숫자가 9007199254740993입니다. Python int에 보관하는 것과 binary64로 변환하는 것을 구별하고, binary64의 최근접 짝수 반올림값을 쓰세요.

The source JSON number is 9007199254740993. Contrast Python int storage with binary64 conversion, then state the nearest ties-to-even binary64 value.

풀이와 확인할 이유Solution and explanation

Python int는 원 정수를 그대로 보관할 수 있습니다. binary64에서는 인접값이 9007199254740992와 9007199254740994이며 주어진 값이 중점입니다. 짝수 방향으로 9007199254740992가 됩니다. reader가 원 숫자 토큰을 보관하면 변환 전 값을 다시 확인할 수 있습니다.

Python int can retain the integer. Neighboring binary64 values are 9007199254740992 and 9007199254740994. The midpoint rounds to 9007199254740992; retained source-token text preserves what preceded conversion.

21. 불리언과 정수 규칙Boolean versus integer rule

필수 integer 칸 x에 JSON true를 넣었습니다. 이 규칙은 JavaScript의 안전한 정수만 허용합니다. true를 자동으로 1로 바꾸어 통과시켜도 되나요?

A required integer field x receives JSON true. This rule allows JavaScript safe integers only. May true be silently converted to one and accepted?

풀이와 확인할 이유Solution and explanation

안 됩니다. JSON true는 불리언이며 이 규칙의 정수가 아닙니다. number·integer·boolean을 별도 종류로 검사합니다. 언어에 따라 산술 변환이 가능하다는 사실과 선언한 자료형 규칙은 다릅니다.

No. JSON true is a boolean, not an integer satisfying this rule. Keep number, integer and boolean contracts distinct from possible language coercions.

22. 보고하지 않은 단위Unreported units

실제 메타데이터에서 units:null이고 변수의 type은 Continuous라고 적혀 있습니다. 이 두 칸만으로 USD 단위를 붙이거나 0 USD로 채울 수 있나요?

Metadata say type Continuous and units:null. Do these fields justify labeling the variable USD or filling it with zero USD?

풀이와 확인할 이유Solution and explanation

없습니다. Continuous는 보고된 종류이고 units:null은 단위를 보고하지 않은 상태입니다. 둘을 따로 보존하고 통화·계산식·측정 단위는 출처에서 더 확인해야 합니다.

No. Type and unit availability are distinct metadata. Preserve the unreported unit and seek additional source information before assigning currency or a measurement formula.

23. 선택 칸의 네 상태Four optional-field outcomes

field x의 규칙에서 required는 False입니다. 첫 행에는 x가 없고 둘째는 x:null입니다. nullable=False와 True에서 각 행의 통과 여부를 비교하세요.

Field x is optional. Row one omits x; row two has x:null. Compare validity when nullable is False versus True.

풀이와 확인할 이유Solution and explanation

없는 첫 칸은 선택 칸이므로 두 설정 모두 통과합니다. 둘째 칸은 실제로 존재하는 null이므로 nullable=False에서는 실패, True에서는 통과합니다. “필수 아님”과 “null 허용”은 다른 약속입니다.

The omitted optional field passes either setting. Present null fails when nullable=False and passes when True. Optional presence and nullability are distinct rules.

24. 빈 표의 스키마 성공Schema success for an empty table

예상 관측은 A–F 여섯 개이지만 검사할 records=[]를 주었습니다. 각 행에 필요한 칸 규칙을 어긴 행은 0개라 allRowsValid가 True입니다. 자료 수집도 완결했다고 할 수 있나요?

Six observations A–F are expected, but records=[] has no violating rows and allRowsValid=True. Does this establish complete collection?

풀이와 확인할 이유Solution and explanation

없습니다. “주어진 행 중 위반 없음”은 빈 목록에서 참이지만 A–F를 하나도 받지 못했습니다. 행별 규칙 검사와 예상 키 완결성을 별도로 보고해야 합니다.

No. No supplied row violates a rule, but none of A–F arrived. Row validation and expected-key completeness answer different questions.

25. 표현만 바뀐 두 수치Two numbers with changed representation

옛 키-값은 A:"1",B:"2", 새 목록은 B:"2.0",A:"1.0"입니다. 키로 맞춘 수치 차이와 순서·표현 변경을 구별하세요. 각 문자열을 정확 수치로 읽습니다.

Old values are A:"1", B:"2"; new order is B:"2.0", A:"1.0". Interpret strings exactly and distinguish value differences from order/representation changes.

풀이와 확인할 이유Solution and explanation

A와 B 차이는 각각 0입니다. 목록 순서와 원 문자열 표현은 달랐습니다. 선택한 수치 투영은 같지만 원 파일 바이트는 같다고 결론내리지 않습니다.

Both keyed differences are zero. Order and source text changed. Equal numeric projections do not establish equal file bytes.

26. 새 값−옛 값New minus old

같은 의미·단위의 키 A에서 옛 값은 1, 새 값은 4/3입니다. new−old와 old−new를 각각 정확히 계산하세요.

For the same key, meaning and units, old A is one and new A is 4/3. Compute both difference directions exactly.

풀이와 확인할 이유Solution and explanation

new−old는 1/3이고 반대는 −1/3입니다. 방향을 명시해야 양수·음수의 뜻을 읽을 수 있습니다. 0.333333은 1/3의 표시 근사이지 정확 등식은 아닙니다.

New−old is 1/3; old−new is −1/3. State direction before interpreting signs. Decimal 0.333333 is an approximation to 1/3.

27. null에서 3으로Null becoming three

양쪽 사본에 키 A가 있고 옛 값은 null, 새 값은 "3"입니다. 상태와 수치 차이를 쓰세요. 실제 옛 값이 "0"이었다면 어떻게 다른가요?

Both copies contain A. Its old value is null and new value "3". State status and numeric difference, then contrast an old measured value "0".

풀이와 확인할 이유Solution and explanation

null→3은 가용성 변경이며 수치 차이는 계산하지 않습니다. 실제 0→3이면 수치값 변경이고 정확 차이는 3입니다. 미가용과 측정된 0은 서로 다른 입력입니다.

Null→three changes availability and has no computed numeric difference. Zero→three changes a numeric value with difference three.

28. 추가·제거·공통 키Added, removed and shared keys

옛 목록은 A:null,B:"2"이고 새 목록은 A:"3",C:null입니다. 합집합 키와 세 상태를 쓰고 단순 파일 길이 비교가 놓치는 것을 설명하세요.

Old rows are A:null, B:"2"; new rows A:"3", C:null. Give union keys and statuses. What does equal file length miss?

풀이와 확인할 이유Solution and explanation

합집합은 {A,B,C}입니다. A는 가용성 변경, B는 제거, C는 추가입니다. 두 사본은 각각 2행이지만 같은 두 관측이 아니므로 길이 일치만으로 보존을 확인하지 못합니다.

The union is {A, B, C}: availability changed for A, B was removed and C added. Both copies have two rows but different key sets.

29. 같은 키에 두 옛 값Two old values for one key

oldRecords에 A:"1"과 A:"2"가 함께 있고 newRecords에는 A:"3"이 하나 있습니다. 이 장의 unique-key 개정 API에서 올바른 동작과 이유는 무엇인가요?

Old records contain A:"1" and A:"2", while the new copy has A:"3". What should the unique-key revision API do, and why?

풀이와 확인할 이유Solution and explanation

중복 의미 키 오류로 거절합니다. 옛 A를 1로 고르면 차이 2, 2로 고르면 차이 1이 되어 임의 선택에 따라 결과가 달라집니다. 필요한 키 구성이나 버전 선택 규칙을 먼저 정해야 합니다.

Reject duplicate semantic keys. Picking old one gives difference two; picking old two gives one. Resolve the key/version contract before comparing.

30. 여섯 상태의 합Sum of six statuses

서로 다른 합집합 키 10개가 추가 2·제거 1·가용성 변경 2·수치 변경 1·수치 동일 3·양쪽 미가용 1로 분류되었습니다. 합을 검산하고 한 키가 추가와 수치 변경에 동시에 속할 수 있는지 설명하세요.

Ten distinct union keys have counts: added two, removed one, availability changed two, numeric changed one, numeric same three, unavailable in both one. Verify the sum and explain whether added and numeric-changed overlap.

풀이와 확인할 이유Solution and explanation

2+1+2+1+3+1=10입니다. 추가 키는 옛 사본에 없으므로 양쪽 가용 수치를 요구하는 수치 변경과 겹치지 않습니다. 상태가 서로 배반적이고 빠짐없이 나뉘는지 확인하는 검산입니다.

The sum is ten. Added keys have no old record, whereas numeric changes require two available values, so those branches are disjoint.

31. 선택한 칸의 일치 범위Scope of equality

두 파일에서 국가·연도·GDP 수치만 골라 키로 맞추었고 모두 같습니다. 단위 설명·각주·다른 변수는 비교하지 않았습니다. 어떤 일치 범위를 보고해야 하나요?

Country/year/GDP values match in two files. Unit descriptions, notes and other variables were not compared. What equality claim is supported?

풀이와 확인할 이유Solution and explanation

비교한 키와 GDP 수치 투영의 일치를 보고합니다. 검사하지 않은 단위 설명·각주·변수도 같았다고 더하지 않습니다. 분석에 필요한 단위가 같은지는 추가 점검해야 합니다.

Equality of the selected keys and GDP projection. Unexamined units, notes and variables require their own checks.

32. 마지막 쉼표의 실제 실패An actual trailing-comma failure

입력 JSON은 {"value":1,}입니다. 정상 객체라고 보고 value를 1로 출력해도 되나요? 이 장의 고정 Python/R reader는 이 입력을 받습니다.

The input is {"value":1,}. May it be silently treated as a valid object with value one by the chapter’s fixed Python/R readers?

풀이와 확인할 이유Solution and explanation

두 고정 reader는 실제로 문법 오류로 거절합니다. 마지막 쉼표를 자동 수정했다는 다른 처리 규칙을 적용한 것이 아닙니다. 실패 출력과 반환 코드를 남기며 성공 summary나 그림은 만들지 않습니다.

Both fixed readers actually reject it. No automatic repair rule was applied. Preserve stderr/exit status without inventing a successful summary or plot.

33. 마지막 유효 답의 위치Index of the latest usable attempt

같은 요청의 시도는 순서대로 (503,json,False),(200,json,True),(200,html,True)입니다. 규칙은 2xx·json/csv/xml·선언된 schema True를 모두 요구합니다. 선택할 0부터 시작하는 시도 위치와 보관할 시도를 쓰세요.

Attempts for one request are (503, json, False), (200, json, True), (200, html, True). The rule requires 2xx, json/csv/xml and declared schema True. Give the zero-based selected index and retained attempts.

풀이와 확인할 이유Solution and explanation

둘째 시도의 위치 1을 선택합니다. 셋째는 HTML이라 조건을 만족하지 않습니다. 세 시도를 모두 보관하며 이 계산은 주어진 메타데이터 규칙 선택입니다.

Select index one, the second attempt. The final HTML reply fails the format rule. Retain all three attempts; this audits supplied metadata.

34. 한 요청만 채운 manifestA manifest missing one request

필수 요청 이름은 page1·page2이고 page1에만 규칙을 통과한 답이 있습니다. page1은 두 번 성공했습니다. 전체 요구가 충족되나요?

Required names are page 1/page 2, but page 1 alone has two validated attempts. Are all requirements satisfied?

풀이와 확인할 이유Solution and explanation

아니오. page1의 여러 성공은 page2의 빈자리를 채우지 않습니다. page1의 마지막 유효 시도를 선택하고 page2는 유효 답 없음으로 남깁니다.

No. Repeated success for page 1 does not supply page 2. Select page 1’s latest validated attempt and report no validated reply for page 2.

35. 요구 목록이 빈 경우Empty requirements

manifest의 requiredRequestIds=[]이고 selection.every(...)가 True를 반환합니다. 이를 이용해 앞으로 필요한 국가·기간을 모두 수집했다고 주장할 수 있나요?

A manifest with requiredRequestIds=[] returns True from selection.every(...). Does that prove every country/period needed for a future analysis was collected?

풀이와 확인할 이유Solution and explanation

없습니다. 비어 있는 요구 목록에는 어긴 요구도 없다는 논리값입니다. 실제로 어떤 요청을 해야 했는지 목록부터 정해야 합니다. 요구 자체가 없는 것과 실제 자료가 완전한 것은 다른 주장입니다.

No. No stated requirement is violated, but the future collection target was never specified. Empty requirements differ from complete actual data.

36. 본문 status와 HTTP 상태Body status versus HTTP status

보관 JSON 객체에 "status":200이 있지만 HTTP 헤더나 transport log는 없습니다. 실제 보관된 것은 무엇이고 무엇은 미상인가요?

Retained JSON contains "status":200, but no HTTP headers or transport log were retained. What is known and what remains unrecorded?

풀이와 확인할 이유Solution and explanation

본문의 API 상태값 200은 읽을 수 있습니다. HTTP 헤더의 실제 상태는 이 자료만으로 복원하지 못합니다. 두 값을 같은 관측으로 합쳐 쓰지 않습니다.

The body’s API status field is known. The historical transport-header status is not recovered from it.

37. 해시의 자리 수Digest length

SHA-256 출력은 256비트이고 16진 한 자리는 4비트입니다. 표준 16진 표현의 길이를 구하세요. 64자리 0 문자열이 형식에 맞는다는 것만으로 실제 파일에서 계산한 증거인가요?

SHA-256 has 256 output bits and each hexadecimal digit represents four bits. Find digest length. Does a syntactically valid 64-zero string prove a file was hashed?

풀이와 확인할 이유Solution and explanation

256/4=64자리입니다. 64개의 0은 16진 형식에는 맞지만 실제 해시 계산 실행을 증명하지 않습니다. 입력으로 받은 문자열인지 원 바이트에서 계산한 결과인지 기록해야 합니다.

The length is 64 digits. A valid-looking string does not prove an execution; distinguish supplied text from a digest actually computed from bytes.

38. 다른 해시의 결론Conclusion from different digests

같은 결정적 SHA-256 함수로 파일 A·B를 해시했는데 출력이 다릅니다. 바이트가 다르다는 결론과 GDP 관측값이 개정됐다는 결론 중 무엇을 바로 얻나요?

The same deterministic SHA-256 function gives different digests for files A/B. Which follows immediately: different bytes or revised GDP observations?

풀이와 확인할 이유Solution and explanation

바이트는 다릅니다. 같은 바이트라면 같은 해시가 나와야 하므로 그 대우입니다. GDP 수치가 바뀌었는지는 키·단위·수치를 비교해야 하며 공백만 바뀌어도 해시는 달라질 수 있습니다.

Different bytes follows by contrapositive. GDP revision needs keyed numeric/unit comparison; whitespace changes can also alter a digest.

39. 파일을 못 읽은 해시 결과Unavailable checksum

R tools::sha256sum이 없는 입력 경로에서 NA를 반환했습니다. 보관된 SHA와 같다고 간주하거나 64자리 0으로 바꾸어도 되나요?

R tools::sha256sum returns NA for a missing input path. May it be treated as a matching digest or replaced with 64 zeros?

풀이와 확인할 이유Solution and explanation

안 됩니다. 파일 읽기 또는 경로를 확인하고 실패 상태를 보존합니다. NA는 계산된 SHA-256 값이 아닙니다. 이 장 실제 R 예제의 stopifnot은 이런 상태를 성공으로 넘기지 않도록 합니다.

No. Preserve failure and check the path/readability. NA is not a computed SHA-256 digest; the fixed example rejects it.

40. 달력 날짜 검사Calendar-date validation

manifest는 실제 YYYY-MM-DD 달력 날짜만 허용합니다. 2024-02-29와 2025-02-29 중 어느 것이 유효하며, 숫자 모양만 검사하면 무엇을 놓치나요?

A manifest requires real YYYY-MM-DD dates. Which of 2024-02-29 and 2025-02-29 is valid? What does a shape-only check miss?

풀이와 확인할 이유Solution and explanation

2024는 윤년이므로 첫 날짜는 유효하지만 2025-02-29는 없습니다. 네 자리-두 자리-두 자리라는 문자 모양만으로 실제 달력 날짜를 확인하지 못합니다. 날짜의 역할과 시간대 기록은 또 별도입니다.

2024 is a leap year, so its date is valid; 2025-02-29 does not exist. Digit pattern alone does not validate a calendar date, nor establish its role or timezone.

41. 실제 두 페이지의 여섯 키Six actual page keys

실제 한국 GDP 요청은 2019–2024년 한 연간 지표이고 각 페이지는 3관측, 전체 pages=2,total=6입니다. 첫 답에는 2024·2023·2022, 다음 답에는 2021·2020·2019가 있습니다. 연도별 키 완결성과 받은 관측 수를 확인하세요.

The actual single-country annual GDP request covers 2019–2024. Two replies contain three observations each, reporting pages=2, total=6. Years are 2024/2023/2022 then 2021/2020/2019. Check key completeness and observation count.

풀이와 확인할 이유Solution and explanation

두 연도 목록의 합집합은 여섯 연도 전체이며 겹침이 없습니다. 받은 관측은 3+3=6개이고 같은 KOR·지표 코드와 묶어 여섯 키를 만듭니다. 요청 범위·단위가 같은지 확인한 뒤 완결성을 보고합니다.

The disjoint year lists cover all six years, giving six observations. Combine each year with KOR and the same indicator code, and verify scope/units before reporting completeness.

42. 실제 기간 평균의 두 분모Two denominators for actual period means

실제 첫 GDP 페이지의 세 값 합은 109205.1438499193이고 전체 여섯 값 합은 210710.3248457542입니다. 각각의 평균을 소수 여섯 자리까지 구하세요. 단위는 2015 USD/인입니다.

The actual first-page GDP sum is 109205.1438499193 for three values; the full sum is 210710.3248457542 for six. Give both means to six decimals, in 2015 USD per person.

풀이와 확인할 이유Solution and explanation

첫 평균은 합을 3으로 나눈 약 36,401.714617, 전체 평균은 합을 6으로 나눈 약 35,118.387474입니다. 두 수치는 서로 다른 고정 연도 집합의 기술 평균입니다. 둘을 같은 기간 평균이라고 보고하지 않습니다.

Divide by three and six, obtaining about 36,401.714617 and 35,118.387474. They describe different fixed sets of years.

43. 손글씨 열과 원 파일 수Digit fields and source-file rows

실제 손글씨 표준 표는 64개 입력과 1개 정답, 원 제공 훈련 3823행과 시험 1797행입니다. 전체 열 수·행 수·비교한 전체 수치 칸 수를 계산하세요.

Actual standardized digits have 64 inputs and one target, with provided training/test sizes 3823/1797. Count total columns, rows and numerical cells including target.

풀이와 확인할 이유Solution and explanation

열은 65개, 행은 5620개, 전체 수치 칸은 5620×65=365300개입니다. 입력만 센 5620×64와 정답 포함 전체를 구별합니다. 행 수는 작성자 수를 뜻하지 않습니다.

There are 65 columns, 5620 rows and 365300 numerical cells. Excluding the target gives another count; record count is not writer count.

44. 경계 원행의 대응Mapping boundary rows

이번 표준 손글씨 사본은 원 optdigits.tra의 3823행 뒤에 optdigits.tes의 1797행이 같은 순서로 대응합니다. 표준 행 3823·3824·5620의 원 파일과 원 파일 안 행 번호를 쓰세요.

This retained standardized digit file matches 3823 optdigits.tra rows followed in order by 1797 optdigits.tes rows. Map standardized rows 3823, 3824, 5620 to original file/row keys.

풀이와 확인할 이유Solution and explanation

차례로 tra의 3823행, tes의 1행, tes의 1797행입니다. 이는 이번 값·순서 대조로 확인한 파일 키입니다. 영구 순서나 사람 ID를 새로 만든 것이 아닙니다.

They map to tra row 3823, tes row 1 and tes row 1797. This verifies snapshot file keys, not permanent ordering or person identity.

45. index_col이 null이면Null index_col

고객 API 메타데이터는 index_col:null이고 Feature13개·Target1개·ID0개를 선언합니다. 표준 원행 위치를 customer ID라고 이름 붙여도 되나요? 전체 열 수도 쓰세요.

Customer metadata declare index_col:null, 13 Features, one Target and zero IDs. May standardized row positions be labeled customer IDs? Give total columns too.

풀이와 확인할 이유Solution and explanation

전체는 14열입니다. 행 위치를 보관 키로 쓸 수는 있지만 확인된 고객 ID라고 부르지는 않습니다. index_col:null은 소스가 index 열을 보고하지 않았다는 사실이며 실제 고객의 고유성을 증명하지 않습니다.

There are 14 columns. Positions can serve as retained row keys, but do not establish customer identity. An unreported index is not a uniqueness proof.

46. 고객 네 셀의 두 분모Two denominators from four customer cells

실제 불만/이탈 조합 (0,0),(0,1),(1,0),(1,1)의 행 수는 2614·295·41·200입니다. 전체 행 수, 이탈 행 수, 불만 행 수와 불만 집단 안 이탈 비율을 구하세요.

Complaint/churn cells (0, 0), (0, 1), (1, 0), (1, 1) contain 2614, 295, 41, 200 rows. Find total, churn count, complaint count and churn fraction within complaints.

풀이와 확인할 이유Solution and explanation

전체 3150, 이탈 295+200=495, 불만 41+200=241행입니다. 불만 집단 안 비율은 200/241입니다. 전체 이탈 비율은 495/3150=11/70으로 다른 분모를 씁니다. 이는 보관 행의 관측 비율입니다.

Total is 3150, churn 495 and complaints 241. Within-complaint churn is 200/241; overall churn is 495/3150=11/70. These use different observed-record denominators.

47. 여섯 파일의 총 바이트Total bytes of six files

실제 보관 파일 크기가 773·773·10639·4226·834735·131728바이트입니다. 합을 구하세요. 원 파일 여섯 개라는 사실을 관측 여섯 개라고 읽을 수 있나요?

Retained files have 773; 773; 10,639; 4,226; 834,735; and 131,728 bytes. Sum them. Does six source files mean six observations?

풀이와 확인할 이유Solution and explanation

합은 982874바이트입니다. 두 JSON 페이지·두 메타데이터·두 CSV라는 파일 역할이 다르며 CSV에는 수천 행이 있습니다. 파일 수·바이트 수·관측 수를 같은 단위로 합치지 않습니다.

They sum to 982874 bytes. The six files are pages, metadata and CSVs with different roles, not six interchangeable observations.

48. 비교한 수치 칸의 합Count of compared numeric cells

선택 GDP6칸, 손글씨 5620×65칸, 고객 3150×14칸을 대조했고 각 비교에서 변경은 0개입니다. 총 대조 칸 수를 구하고 보고 범위를 쓰세요.

Compare six selected GDP cells, 5620×65 digit cells and 3150×14 customer cells, with zero changes in each. Count compared cells and state the scope.

풀이와 확인할 이유Solution and explanation

6+365300+44100=409406칸입니다. 보고는 이 고정 사본의 해당 대응 수치 칸에 대한 것입니다. 입력의 단위·정체성·자료원 전체 역사까지 자동 검증한 수가 아닙니다.

The total is 409406 cells. This describes the selected corresponding values in retained copies, not automatic verification of units, identities or the source’s entire history.

49. 올림의 페이지 부등식Ceiling and the final page

N>0개 기록과 정수 페이지 크기 b≥1에서 P=ceil(N/b)입니다. (P−1)b<N≤Pb를 증명하고 마지막 페이지 행 수 범위를 쓰세요.

For N>0 records and integer capacity b≥1, let P=ceil(N/b). Prove (P−1)b<N≤Pb and give the last-page row range.

풀이와 확인할 이유Solution and explanation

올림 정의에서 P−1<N/b≤P입니다. 양수 b를 곱하면 부등식이 유지됩니다. 마지막 행 수 N−(P−1)b는 1 이상 b 이하의 정수입니다. 빈 서버의 별도 규칙은 N>0인 이 증명 밖입니다.

P−1<N/b≤P1≤N−(P−1)b≤b\begin{gathered}P-1<N/b\le P\\1\le N-(P-1)b\le b\end{gathered}

The ceiling gives P−1<N/b≤P. Multiply by positive b; the final integer count N−(P−1)b lies from one through b. The empty-server convention is outside this N>0 proof.

P−1<N/b≤P1≤N−(P−1)b≤b\begin{gathered}P-1<N/b\le P\\1\le N-(P-1)b\le b\end{gathered}

50. 반복 평균 차이의 항등식Identity for multiplicity bias

N≥1개의 고정 키 i에 유한 값 xᵢ와 비음수 정수 반복수 mᵢ가 있습니다. M=Σmᵢ>0, a=Σxᵢ/N, b=Σmᵢxᵢ/M입니다. b−a=M⁻¹Σ(mᵢ−M/N)(xᵢ−a)를 증명하세요.

N≥1 fixed keys have finite xᵢ and nonnegative integer counts mᵢ. Define M=Σmᵢ>0, a=Σxᵢ/N, b=Σmᵢxᵢ/M. Prove b−a=M⁻¹Σ(mᵢ−M/N)(xᵢ−a).

풀이와 확인할 이유Solution and explanation

Σ(xᵢ−a)=0이고 b−a=M⁻¹Σmᵢ(xᵢ−a)입니다. 따라서 각 mᵢ에서 M/N을 빼도 합은 바뀌지 않습니다. 원값이 반복 내내 고정되고 두 분모가 양수라는 전제가 필요합니다.

∑i(xi−a)=0M(b−a)=∑imi(xi−a)=∑i(mi−M/N)(xi−a)\begin{gathered}\sum_i(x_i-a)=0\\M(b-a)=\sum_im_i(x_i-a)\\=\sum_i(m_i-M/N)(x_i-a)\end{gathered}

Centered values sum to zero. Express M(b−a) as Σmᵢ(xᵢ−a), then subtract (M/N) times that zero sum. Fixed values and positive denominators justify each mean.

∑i(xi−a)=0M(b−a)=∑imi(xi−a)=∑i(mi−M/N)(xi−a)\begin{gathered}\sum_i(x_i-a)=0\\M(b-a)=\sum_im_i(x_i-a)\\=\sum_i(m_i-M/N)(x_i-a)\end{gathered}

51. 모든 값 벡터에서 평균을 보존할 조건Preserve every possible value-vector mean

N≥1,고정 비음수 정수 mᵢ와 M=Σmᵢ>0입니다. 모든 유한 실수 값 벡터 x에 대해 Σmᵢxᵢ/M=Σxᵢ/N일 필요충분조건을 구하세요.

Fix N≥1, nonnegative integer mᵢ and M=Σmᵢ>0. Give a necessary and sufficient condition for Σmᵢxᵢ/M=Σxᵢ/N for every finite real vector x.

풀이와 확인할 이유Solution and explanation

모든 i에서 mᵢ/M=1/N,즉 mᵢ=M/N입니다. 필요성은 한 위치 j만 1이고 나머지 0인 벡터를 대입해 얻습니다. 충분성은 균등 무게를 식에 넣으면 됩니다. 모든 키를 두 번 받은 경우도 평균을 보존하므로 이 성질만으로 반복 없음은 증명하지 못합니다.

mj/M=1/Nm_j/M=1/N

Require mᵢ/M=1/N for every i. For necessity use the vector with only coordinate j equal to one. Uniform weights prove sufficiency. Repeating every key twice also preserves all means, so this property does not imply no repetition.

mj/M=1/Nm_j/M=1/N

52. 못 받은 세 값의 가정 범위Assumed range for three unreceived values

새 설명용 문제에서 예상 6키 중 받은 3값은 10·20·30이고 나머지 3값은 모릅니다. 모르는 값 각각이 [0,60]에 있다는 추가 가정만 두세요. 전체 6키 평균의 가능한 최소·최대를 구하세요.

In a new toy problem, three of six expected values are 10, 20, 30; the other three are unknown. Assume each unknown lies in [0, 60]. Find the smallest/largest full mean.

풀이와 확인할 이유Solution and explanation

알려진 합은 60,미지 합 범위는 0부터 180입니다. 전체 평균은 [60/6,(60+180)/6]=[10,40]입니다. 미지 세 값이 모두 0 또는 60일 때 양끝을 달성합니다. 이 범위는 관측에서 발견한 값이 아니라 주어진 상하한 가정을 사용합니다.

Known sum 60 plus unknown sum from 0 to 180 gives means in [10, 40]. Setting all unknowns to zero or 60 attains the endpoints. The range uses the stated bounds, not newly observed values.

53. 평균 일치의 역방향 실패Failure of the converse for means

같은 두 키 A·B에 대해 D1의 값은 10·30,D2의 값은 0·40입니다. 평균을 비교하고 평균 일치가 키별 수치 일치를 뜻하는지 설명하세요.

For keys A/B, table D1 has 10/30 and D2 has 0/40. Compare means and decide whether mean equality establishes keyed-value equality.

풀이와 확인할 이유Solution and explanation

두 평균은 20입니다. 하지만 A는 10과 0,B는 30과 40으로 다릅니다. 평균은 여러 다른 표를 같은 수치로 보내는 함수여서 한 통계의 일치만으로 원 표의 같음을 역으로 증명하지 못합니다.

Both average 20, yet both keyed values differ. A statistic can map different tables to the same result, so its equality does not prove input equality.

54. 결정적 함수의 재현Reproduction under a deterministic function

C(D)는 정한 키·수치·가용성을 같은 순서로 놓은 표입니다. C(D1)=C(D2)이고 T는 그 표만을 입력받는 동일한 결정적 함수입니다. 후속 출력의 일치를 보이고, 함수가 외부 시계나 서버 값을 더 읽으면 어떤 전제를 다시 봐야 하나요?

C(D) lists selected keys, values and availability in a common order. C(D1)=C(D2), and the same deterministic T takes only that table. Prove equal outputs and explain a function additionally reading a clock/server.

풀이와 확인할 이유Solution and explanation

같은 함수에 같은 입력을 대입하므로 T(C(D1))=T(C(D2))입니다. 외부 시각·서버 값을 사용하면 입력이 C(D)만이 아니게 됩니다. 그 외부 상태까지 같게 기록하거나 함수의 입력으로 명시해야 같은 대입 논증을 쓸 수 있습니다.

T(C(D1))=T(C(D2))T(C(D_1))=T(C(D_2))

Equal arguments give T(C(D1))=T(C(D2)). A function reading external state has more inputs than C(D); include or fix those inputs before applying the same argument.

T(C(D1))=T(C(D2))T(C(D_1))=T(C(D_2))

55. 실패 시도를 뒤에 붙여도 선택이 유지되는 이유Appending an unusable attempt

순서 있는 시도 목록에서 선언된 규칙을 통과한 위치 집합 V가 비어 있지 않습니다. 선택은 max V입니다. 규칙을 통과하지 못한 시도를 마지막에 붙일 때 선택이 유지됨을 증명하세요.

In an ordered attempt list, nonempty V contains indices satisfying the declared rule and selection is max V. Prove selection is unchanged when an unusable attempt is appended.

풀이와 확인할 이유Solution and explanation

새 시도는 유효 위치 집합에 들어가지 않으므로 V가 그대로이고 최댓값도 같습니다. 반대로 유효한 새 시도를 마지막에 붙이면 새 위치가 기존 모든 위치보다 커 선택이 바뀝니다. 두 경우 모두 이전 기록은 남습니다.

The new index does not enter V, so its maximum stays unchanged. Appending a usable attempt adds a larger valid index and changes selection. Neither case requires deleting earlier records.

56. 스키마 검사와 전체자료 검사Schema pass rate versus completeness

여섯 예상 키 중 A·B·C의 세 행만 받았고 각 행은 required key:string,value:exact-number 문자열 규칙을 모두 통과합니다. 통과 비율 100%와 완결성의 차이를 설명하세요.

Only A/B/C of six expected keys arrived, and all three rows satisfy required string-key/numeric-text rules. Explain the difference between a100% pass rate and completeness.

풀이와 확인할 이유Solution and explanation

받은 3행 중 3행이 규칙을 만족해 행별 통과 비율은 100%입니다. 예상 6키 중 받은유일키는 3개여서 수집은 미완결입니다. 두 분모가 3과 6으로 다르고 검사하는 성질도 다릅니다.

All three supplied rows pass, giving 100% for that denominator. Only three of six expected keys arrived, so collection remains incomplete. These use different denominators and properties.

57. 보조함수의 거절과 JSON 문법Reader policy versus JSON grammar

이 장 R reader는 중복 이름 {"x":1,"x":2}과 "\u0000"을 거절합니다. 두 경우를 모두 “JSON 문법상 불가능”이라고 일반화해도 되나요?

The included R reader rejects duplicate names {"x":1,"x":2} and "\u0000". May both rejections be generalized as impossible JSON grammar?

풀이와 확인할 이유Solution and explanation

안 됩니다. 중복 이름 거절은 이 reader가 선택한 유일 이름 정책이고, U+0000 거절은 R 문자열 지원 한계입니다. 다른 reader의 처리와 JSON 문법을 구분해 설명합니다. 지원 범위 밖 실패는 관측값 0이라는 뜻도 아닙니다.

No. Unique-name rejection is an explicit reader policy; U+0000 rejection reflects an R-string support limit. Distinguish grammar, implementation policy and unsupported input.

58. 해시 충돌의 유한 비둘기집 증명Finite pigeonhole argument for digest collisions

33바이트 입력은 2²⁶⁴개,256비트 해시 출력은 2²⁵⁶개입니다. 서로 다른 두 입력이 같은 출력을 갖는 경우가 존재함을 증명하세요. 이 증명이 실제 충돌 한 쌍을 계산해 주나요?

There are 2²⁶⁴ possible 33-byte inputs and 2²⁵⁶ possible 256-bit outputs. Prove that distinct inputs share some output. Does this calculate a particular colliding pair?

풀이와 확인할 이유Solution and explanation

입력을 서로 다른 출력에 하나씩 배정하기에는 출력 수가 작습니다. 비둘기집 원리로 적어도 한 출력에 두 입력이 대응합니다. 존재 증명이지 특정 충돌 쌍을 찾은 계산은 아닙니다. 같은 해시를 수학적인 바이트 일대일 대응으로 해석하지 않는 이유입니다.

There are too few outputs to assign a different one to each input. Pigeonhole gives existence of a collision, not an explicit pair. A digest is not a mathematically one-to-one encoding of all files.

59. 같이 출력되는 숫자 토큰과 문자열Number token and quoted string printing alike

Python reader가 JSON 숫자 1을 NumberText("1")로, JSON 문자열 "1"을 보통 str로 저장합니다. 둘을 print하면 모두 1처럼 보입니다. 종류 구별을 확인할 정보와 그 이유를 쓰세요.

The Python reader stores JSON number 1 as NumberText("1") and JSON string "1" as ordinary str. Both print alike. What additional information distinguishes them, and why?

풀이와 확인할 이유Solution and explanation

type이나 NumberText 태그 여부를 함께 확인합니다. 화면 글자가 같아도 원 JSON 종류는 다릅니다. 원문을 보존한 태그와 이름 존재·null 표시를 함께 두면 스키마에서 종류를 분리할 수 있습니다. R의 data13_json_number 태그도 같은 목적입니다.

Inspect type/tag information. Equal printed characters do not imply equal JSON kinds. A retained number tag preserves this distinction for schema handling; R uses its data 13_json_number tag similarly.

60. 34실행·4실패·26그림Thirty-four runs, four failures, twenty-six plots

고정 참조 프로그램 34개 중 예상실패는 4개이고 성공은 30개입니다. 성공 중 주소만 출력하는 Python/R 두 개와 숫자토큰을 설명하는 두 개는 그림을 만들지 않습니다. 실제 SVG 수를 구하고 실패를 성공 그림으로 채우지 않는 이유를 쓰세요.

Of 34 fixed reference programs, four are expected failures and 30 succeed. Two successful Python/R URL-only programs and two number-token examples make no plot. Count SVGs and explain why failed runs are not filled with successful figures.

풀이와 확인할 이유Solution and explanation

30−2−2=26개입니다. 프로그램 실행·성공·그림 생성은 서로 다른 개수입니다. 실패한 4개에는 실제 stderr와 반환코드를 보관하며 없는 성공summary나SVG를 붙이지 않습니다. 환경 조회나 별도 reader검증 프로세스는 이 34개 고정 참조 프로그램 개수와 별도 범위로 기록합니다.

There are 30−2−2=26 SVGs. Execution, success and plot generation are distinct counts. Preserve actual stderr/exit status for failures. Environment probes and separate reader checks are recorded outside the 34 fixed-reference count.

자료와 출처Data and sources

실습에 추가한 실제 입력과 출처Additional observed lab inputs and provenance

실제 자료 사례Actual-data cases · 원자료·단위·결측·변환·출처Inputs, units, missingness, transformations and sources

자료별 확보일·원행 식별·단위·이용 조건은 출처 기록을 확인하세요. 학습 사본은 제공처의 현재 최신 자료와 다를 수 있습니다.Consult each source record for retrieval dates, row identifiers, units and terms. Teaching copies can differ from current provider releases.

자료사전·출처·이용 조건Data dictionary, sources and terms