From 174ee0979e27a648dc51e977cde0eae6b7ef0ef3 Mon Sep 17 00:00:00 2001 From: poo Date: Wed, 6 Oct 2021 18:05:51 +0900 Subject: [PATCH 01/13] ko: Working-With-Data base README Signed-off-by: poo --- 2-Working-With-Data/translations/README.ko.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 2-Working-With-Data/translations/README.ko.md diff --git a/2-Working-With-Data/translations/README.ko.md b/2-Working-With-Data/translations/README.ko.md new file mode 100644 index 00000000..b321448b --- /dev/null +++ b/2-Working-With-Data/translations/README.ko.md @@ -0,0 +1,17 @@ +# 데이터작업 + +![데이터 사랑](images/data-love.jpg) +> 촬영작가: Alexander Sinn on Unsplash + +이 수업에서는 응용 프로그램에서 데이터를 관리, 조작 및 사용할 수 있는 여러 방법에 대해 배웁니다. 또한 관계형 및 비관계형 데이터베이스에 대해 배우고 데이터가 이러한 데이터베이스에 어떻게 저장되는지 배웁니다. 파이썬으로 데이터를 다루는 기본 원리를 배우며, 이를 통해 데이터를 관리하고 마이닝(data mining) 할 수 있는 다양한 방법을 발견할 수 있을 것입니다. + +### 주제 + +1. [관계형 데이터베이스](05-relational-databases/README.md) +2. [비관계형 데이터베이스](06-non-relational/README.md) +3. [Python 활용하기](07-python/README.md) +4. [데이터 준비](08-data-preparation/README.md) + +### 크레딧 + +강의를 제작한 분: [Christopher Harrison](https://twitter.com/geektrainer), [Dmitry Soshnikov](https://twitter.com/shwars) 와 [Jasmine Greenaway](https://twitter.com/paladique) \ No newline at end of file From 882294d1f70cc5672c7f763148f8c72b0f2bb967 Mon Sep 17 00:00:00 2001 From: poo Date: Thu, 7 Oct 2021 15:44:07 +0900 Subject: [PATCH 02/13] ko: Relational Databases README(1) Signed-off-by: poo --- .../translations/README.ko.md | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 2-Working-With-Data/05-relational-databases/translations/README.ko.md diff --git a/2-Working-With-Data/05-relational-databases/translations/README.ko.md b/2-Working-With-Data/05-relational-databases/translations/README.ko.md new file mode 100644 index 00000000..3bffafc8 --- /dev/null +++ b/2-Working-With-Data/05-relational-databases/translations/README.ko.md @@ -0,0 +1,181 @@ +# 데이터 작업: 관계형 데이터베이스 + +|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../sketchnotes/05-RelationalData.png)| +|:---:| +| 데이터 작업: 관계형 데이터베이스 - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | + +과거에 스프레드 시트를 통해 정보를 저장한 경험이 있을 것입니다. 이는 행(rows)과 열(columns)을 가지고 있으며, 행(rows)에는 정보(혹은 데이터)를 나타내고 열(columns)에는 해당 정보(또는 메타데이터)를 정의합니다. 관계형 데이터베이스는 테이블의 행과 열의 핵심 원리를 기반으로 구축되며 여러 테이블에 정보를 분산시킬 수 있습니다. 이를 통해 더 복잡한 데이터를 다룰 수 있을 뿐만 아니라 중복을 방지하고, 데이터 탐색 방식에서 유연성을 가질 수 있습니다. 관계형 데이터베이스의 개념을 좀 더 살펴보겠습니다. + +## [Pre-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/8) + +## 모든 것의 시작 : 테이블(table) + +A relational database has at its core tables. 스프레드 시트와 마찬가지로 테이블은 열과 행으로 이루어져 있습니다. 행에는 도시 이름이나 강우량등의 작업하고자 하는 데이터나 정보를 나타냅니다. 열에는 저장된 데이터에 대한 설명을 나타냅니다. + +그렇다면 이제 실습을 시작해보겠습니다. 우선 도시 정보를 저장하는 테이블을 생성해 보도록 하겠습니다. 아래와 같이 나라와 도시 이름을 저장할 수 있을 것입니다.: + +| City | Country | +| -------- | ------------- | +| Tokyo | Japan | +| Atlanta | United States | +| Auckland | New Zealand | + +**city**, **country** 및 **population**의 열 이름은 저장 중인 데이터를 가리키며, 각 행에는 도시에 대한 정보가 저장되어 있습니다. + +## 단일 테이블의 단점 + +위의 테이블은 비교적 친숙해 보일 수도 있습니다. 이제 데이터베이스에 급증하는 연간 강우량(밀리미터 단위)에 대한 몇가지 데이터를 추가해 보겠습니다. 만약 우리가 2018,2018 그리고 2020년의 데이터를 추가한다면, 다음과 같을 것입니다.: + +| City | Country | Year | Amount | +| ----- | ------- | ---- | ------ | +| Tokyo | Japan | 2020 | 1690 | +| Tokyo | Japan | 2019 | 1874 | +| Tokyo | Japan | 2018 | 1445 | + +테이블에서 뭔가 알아차리셨나요? 도시의 이름과 국가를 계속해서 중복적으로 사용하고 있는 것을 발견했을 것입니다. 이러한 경우 불필요한 복사본을 저장함에 따라 저장소 낭비가 발생하게 됩니다. 결국, Tokyo는 하나만 존재해야 합니다. + +그렇다면 다른 방식으로 접근해 보겠습니다. 각 연도에 대한 새 열을 추가하겠습니다.: + +| City | Country | 2018 | 2019 | 2020 | +| -------- | ------------- | ---- | ---- | ---- | +| Tokyo | Japan | 1445 | 1874 | 1690 | +| Atlanta | United States | 1779 | 1111 | 1683 | +| Auckland | New Zealand | 1386 | 942 | 1176 | + +이러한 방식은 행에 대한 중복을 피할수는 있지만, 몇 가지 해결해야할 과제가 존재합니다. 우선, 새로운 연도가 추가될 때마다 테이블의 구조를 수정해야만 합니다. 또한, 데이터가 증가함에 따라 값을 검색하고 계산하는 것이 더 어려워집니다. + +이것이 여러 테이블의 관계가 필요한 이유입니다. 데이터를 분리함으로써 중복을 방지하고, 데이터를 보다 유연하게 사용할 수 있습니다. + +## 관계의 개념 + +다시 데이터를 보며 어떻게 데이터를 분할할 것인지 결정해 보겠습니다. 이미 우리는 City의 Name과 Country를 저장하는 것이 최선의 방법인 것을 알고 있고, 실제로 가장 잘 동작할 것입니다. + +| City | Country | +| -------- | ------------- | +| Tokyo | Japan | +| Atlanta | United States | +| Auckland | New Zealand | + +하지만 우리가 다음 테이블을 생성하기 이전에, 우리는 각각의 도시를 어떻게 참조할 것인지 생각해 봐야합니다. 구분 지을 수 있는 여러 형태의 식별자,ID 또는 기본키(Primary key)가 필요합니다. 기본키(Primary key)는 테이블에서 특정 행을 식별하는데 사용되는 값입니다. 기본키로 값 자체(ex. 도시 이름)를 사용할 수도 있지만, 대부분 숫자 또는 다른 식별자가 사용됩니다. ID 값이 바뀌면서 관계를 깨뜨릴 수 있기 때문에 대부분 기본키 또는 자동 생성된 번호를 사용합니다. + +> ✅ 기본키(Primary key)는 주로 PK라고 약칭 됩니다. + +### 도시 + +| city_id | City | Country | +| ------- | -------- | ------------- | +| 1 | Tokyo | Japan | +| 2 | Atlanta | United States | +| 3 | Auckland | New Zealand | + +> ✅ 이번 강의에서 우리는 "id"와 "기본키(Primary key)"를 혼용해서 사용하고 있습니다. 이에 대한 자세한 개념은 나중에 살펴볼 데이터 프레임(DataFrames)에 적용됩니다. 데이터 프레임(DataFrames)이 "기본 키"라는 용어를 사용하지는 않지만, 동일한 방식인 것을 알 수 있습니다. + +도시 테이블이 생성되었으니, 강우량 테이블을 만들어 보겠습니다. 도시에 대한 전체 정보를 가져오는 대신, 이제 우리는 id를 사용할 수 있습니다. 모든 테이블은 id 또는 기본 키를 가져야 하므로, 새로 생성되는 테이블도 *id* 열을 가져야 합니다. + +### 강수량 + +| rainfall_id | city_id | Year | Amount | +| ----------- | ------- | ---- | ------ | +| 1 | 1 | 2018 | 1445 | +| 2 | 1 | 2019 | 1874 | +| 3 | 1 | 2020 | 1690 | +| 4 | 2 | 2018 | 1779 | +| 5 | 2 | 2019 | 1111 | +| 6 | 2 | 2020 | 1683 | +| 7 | 3 | 2018 | 1386 | +| 8 | 3 | 2019 | 942 | +| 9 | 3 | 2020 | 1176 | + +새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **왜래 키(foreign key)**라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. + +> ✅ 외래키(Foreign key)는 주로 FK라고 약칭합니다. + +## 데이터 조회 + +With our data separated into two tables, you may be wondering how we retrieve it. If we are using a relational database such as MySQL, SQL Server or Oracle, we can use a language called Structured Query Language or SQL. SQL (sometimes pronounced sequel) is a standard language used to retrieve and modify data in a relational database. + +To retrieve data you use the command `SELECT`. At its core, you **select** the columns you want to see **from** the table they're contained in. If you wanted to display just the names of the cities, you could use the following: + +```sql +SELECT city +FROM cities; + +-- Output: +-- Tokyo +-- Atlanta +-- Auckland +``` + +`SELECT` is where you list the columns, and `FROM` is where you list the tables. + +> [NOTE] SQL syntax is case-insensitive, meaning `select` and `SELECT` mean the same thing. However, depending on the type of database you are using the columns and tables might be case sensitive. As a result, it's a best practice to always treat everything in programming like it's case sensitive. When writing SQL queries common convention is to put the keywords in all upper-case letters. + +The query above will display all cities. Let's imagine we only wanted to display cities in New Zealand. We need some form of a filter. The SQL keyword for this is `WHERE`, or "where something is true". + +```sql +SELECT city +FROM cities +WHERE country = 'New Zealand'; + +-- Output: +-- Auckland +``` + +## 데이터 조인 + +Until now we've retrieved data from a single table. Now we want to bring the data together from both **cities** and **rainfall**. This is done by *joining* them together. You will effectively create a seam between the two tables, and match up the values from a column from each table. + +In our example, we will match the **city_id** column in **rainfall** with the **city_id** column in **cities**. This will match the rainfall value with its respective city. The type of join we will perform is what's called an *inner* join, meaning if any rows don't match with anything from the other table they won't be displayed. In our case every city has rainfall, so everything will be displayed. + +Let's retrieve the rainfall for 2019 for all our cities. + +We're going to do this in steps. The first step is to join the data together by indicating the columns for the seam - **city_id** as highlighted before. + +```sql +SELECT cities.city + rainfall.amount +FROM cities + INNER JOIN rainfall ON cities.city_id = rainfall.city_id +``` + +We have highlighted the two columns we want, and the fact we want to join the tables together by the **city_id**. Now we can add the `WHERE` statement to filter out only year 2019. + +```sql +SELECT cities.city + rainfall.amount +FROM cities + INNER JOIN rainfall ON cities.city_id = rainfall.city_id +WHERE rainfall.year = 2019 + +-- Output + +-- city | amount +-- -------- | ------ +-- Tokyo | 1874 +-- Atlanta | 1111 +-- Auckland | 942 +``` + +## 요약 + +Relational databases are centered around dividing information between multiple tables which is then brought back together for display and analysis. This provides a high degree of flexibility to perform calculations and otherwise manipulate data. You have seen the core concepts of a relational database, and how to perform a join between two tables. + +## 🚀 챌린지 + +There are numerous relational databases available on the internet. You can explore the data by using the skills you've learned above. + +## 강의 후 퀴즈 + +## [Post-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/9) + +## Review & Self Study + +There are several resources available on [Microsoft Learn](https://docs.microsoft.com/learn?WT.mc_id=academic-40229-cxa) for you to continue your exploration of SQL and relational database concepts + +- [Describe concepts of relational data](https://docs.microsoft.com//learn/modules/describe-concepts-of-relational-data?WT.mc_id=academic-40229-cxa) +- [Get Started Querying with Transact-SQL](https://docs.microsoft.com//learn/paths/get-started-querying-with-transact-sql?WT.mc_id=academic-40229-cxa) (Transact-SQL is a version of SQL) +- [SQL content on Microsoft Learn](https://docs.microsoft.com/learn/browse/?products=azure-sql-database%2Csql-server&expanded=azure&WT.mc_id=academic-40229-cxa) + +## 과제 + +[Assignment Title](assignment.md) From c30d528673e612b5c9bebdc08fc17e751b991f4f Mon Sep 17 00:00:00 2001 From: poo Date: Wed, 13 Oct 2021 17:57:13 +0900 Subject: [PATCH 03/13] ko: Relational Databases README(2) Signed-off-by: poo --- .../translations/README.ko.md | 42 +++++++++---------- 2-Working-With-Data/translations/README.ko.md | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/2-Working-With-Data/05-relational-databases/translations/README.ko.md b/2-Working-With-Data/05-relational-databases/translations/README.ko.md index 3bffafc8..1ec53461 100644 --- a/2-Working-With-Data/05-relational-databases/translations/README.ko.md +++ b/2-Working-With-Data/05-relational-databases/translations/README.ko.md @@ -1,6 +1,6 @@ # 데이터 작업: 관계형 데이터베이스 -|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../sketchnotes/05-RelationalData.png)| +|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../../sketchnotes/05-RelationalData.png)| |:---:| | 데이터 작업: 관계형 데이터베이스 - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | @@ -86,15 +86,15 @@ A relational database has at its core tables. 스프레드 시트와 마찬가 | 8 | 3 | 2019 | 942 | | 9 | 3 | 2020 | 1176 | -새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **왜래 키(foreign key)**라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. +새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **외래 키(foreign key)**라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. > ✅ 외래키(Foreign key)는 주로 FK라고 약칭합니다. ## 데이터 조회 -With our data separated into two tables, you may be wondering how we retrieve it. If we are using a relational database such as MySQL, SQL Server or Oracle, we can use a language called Structured Query Language or SQL. SQL (sometimes pronounced sequel) is a standard language used to retrieve and modify data in a relational database. +데이터가 두개의 테이블로 분리되어 있을때는, 어떻게 데이터를 검색할까요?. 만약 우리가 MYSQL, SQL Server, Oracle과 같은 관계형 데이터베이스를 사용하는 경우, 우리는 구조화된 질의언어 혹은 SQL을 사용할 수 있습니다 . SQL("에스큐엘"이라고 발음된다.)은 관계형 데이터베이스에서 데이터를 검색하고 수정하는 데 사용되는 표준 언어입니다. -To retrieve data you use the command `SELECT`. At its core, you **select** the columns you want to see **from** the table they're contained in. If you wanted to display just the names of the cities, you could use the following: +데이터를 검색할 때는 `SELECT` 명령어를 사용합니다. 핵심은 데이터가 담긴 테이블에서(**from**) 찾고자 하는 열을 검색(**select**)하는 것입니다. 만약 도시의 이름만 보이고 싶다면, 다음 내용을 따라하세요: ```sql SELECT city @@ -106,11 +106,11 @@ FROM cities; -- Auckland ``` -`SELECT` is where you list the columns, and `FROM` is where you list the tables. +`SELECT`는 열의 집합이라면, `FROM`은 테이블의 집합이라고 할 수 있습니다. -> [NOTE] SQL syntax is case-insensitive, meaning `select` and `SELECT` mean the same thing. However, depending on the type of database you are using the columns and tables might be case sensitive. As a result, it's a best practice to always treat everything in programming like it's case sensitive. When writing SQL queries common convention is to put the keywords in all upper-case letters. +> [주의] SQL 문법은 대소문자를 구분하지 않으며, `select`와 `SELECT`는 서로 같습니다. 그러나, 데이터베이스의 타입에 따라 열과 테이블은 대소문자를 구분할 수도 있습니다. 따라서, 대소문자를 구분해 프로그래밍하는 것이 좋습니다. SQL 쿼리를 작성할 때 키워드를 대문자로 적는 것이 원칙입니다. -The query above will display all cities. Let's imagine we only wanted to display cities in New Zealand. We need some form of a filter. The SQL keyword for this is `WHERE`, or "where something is true". +위의 예시 쿼리는 모든 도시를 나타냅니다. 여기서 뉴질랜드(New Zealand)의 도시만 보여주고 싶다면 어떻게 할까요? 사용할 키워드는 `WHERE`, 혹은 "where something is true" 입니다. ```sql SELECT city @@ -123,13 +123,13 @@ WHERE country = 'New Zealand'; ## 데이터 조인 -Until now we've retrieved data from a single table. Now we want to bring the data together from both **cities** and **rainfall**. This is done by *joining* them together. You will effectively create a seam between the two tables, and match up the values from a column from each table. +우리는 이전까지 단일 테이블에서 데이터를 검색했습니다. 이제 도시(**city**)와 강수량(**rainfall**)의 데이터를 하나로 통합해 보여주려 합니다. 이것은 데이터 *조인*을 통해서 할 수 있습니다. 데이터 조인은 두개의 다른 테이블의 열을 일치시킴으로써 효과적으로 이어줍니다. -In our example, we will match the **city_id** column in **rainfall** with the **city_id** column in **cities**. This will match the rainfall value with its respective city. The type of join we will perform is what's called an *inner* join, meaning if any rows don't match with anything from the other table they won't be displayed. In our case every city has rainfall, so everything will be displayed. +예를들어, 강수량(**rainfall) 테이블의 **city_id** 열과 도시(**city**) 테이블의 **city_id** 열을 매칭할 수 있습니다. 조인을 통해 각 도시들과 그에 맞는 강수량을 매칭할 것입니다. 여러 조인의 종류 중에서 먼저 다룰 것은 *inner* 조인입니다. *inner* 조인은 테이블간의 행이 정확하게 일치하지 않으면 표시되지 않습니다. 위의 예시의 경우 모든 도시에 비가 내리므로, 모든 행이 표시될 것입니다. -Let's retrieve the rainfall for 2019 for all our cities. +그렇다면 모든 도시의 2019년 강수량을 보겠습니다. -We're going to do this in steps. The first step is to join the data together by indicating the columns for the seam - **city_id** as highlighted before. +첫번째로 이전에 강조했던 **city_id** 열을 매칭해 데이터를 결합하겠습니다. ```sql SELECT cities.city @@ -138,7 +138,7 @@ FROM cities INNER JOIN rainfall ON cities.city_id = rainfall.city_id ``` -We have highlighted the two columns we want, and the fact we want to join the tables together by the **city_id**. Now we can add the `WHERE` statement to filter out only year 2019. +같은 **city_id**값과 함께 테이블 명을 명시함으로써, 테이블 조인에 핵심적인 열을 강조했습니다. 이제 `WHERE` 구문을 추가해 2019년만 검색해 보겠습니다. ```sql SELECT cities.city @@ -158,24 +158,24 @@ WHERE rainfall.year = 2019 ## 요약 -Relational databases are centered around dividing information between multiple tables which is then brought back together for display and analysis. This provides a high degree of flexibility to perform calculations and otherwise manipulate data. You have seen the core concepts of a relational database, and how to perform a join between two tables. +관계형 데이터 베이스는 여러 테이블 간에 정보를 분산시키며, 데이터 분석과 검색을 위해 결합됩니다. 계산을 수행할때나 조작할때 높은 유연성을 보장하는 것이 장점입니다. 지금까지 관계형 데이터베이스의 핵심 개념과 두 테이블 간의 조인을 수행하는 방법을 살펴보았습니다. ## 🚀 챌린지 -There are numerous relational databases available on the internet. You can explore the data by using the skills you've learned above. +인터넷에는 수많은 관계형 데이터베이스가 있습니다. 위에서 배운 내용과 기술을 토대로 이제 데이터를 자유롭게 다룰 수 있습니다. ## 강의 후 퀴즈 -## [Post-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/9) +## [강의 후 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/9) -## Review & Self Study +## 리뷰 & 복습 -There are several resources available on [Microsoft Learn](https://docs.microsoft.com/learn?WT.mc_id=academic-40229-cxa) for you to continue your exploration of SQL and relational database concepts +[Microsoft 학습](https://docs.microsoft.com/learn?WT.mc_id=academic-40229-cxa)에 SQL 및 관계형 데이터베이스 개념에 대한 학습을 계속할 수 있는 자료들이 있습니다. -- [Describe concepts of relational data](https://docs.microsoft.com//learn/modules/describe-concepts-of-relational-data?WT.mc_id=academic-40229-cxa) -- [Get Started Querying with Transact-SQL](https://docs.microsoft.com//learn/paths/get-started-querying-with-transact-sql?WT.mc_id=academic-40229-cxa) (Transact-SQL is a version of SQL) -- [SQL content on Microsoft Learn](https://docs.microsoft.com/learn/browse/?products=azure-sql-database%2Csql-server&expanded=azure&WT.mc_id=academic-40229-cxa) +- [관계형 데이터의 개념 설명](https://docs.microsoft.com//learn/modules/describe-concepts-of-relational-data?WT.mc_id=academic-40229-cxa) +- [Transact-SQL로 시작하는 쿼리](https://docs.microsoft.com//learn/paths/get-started-querying-with-transact-sql?WT.mc_id=academic-40229-cxa) (Transact-SQL SQL의 버전이다.) +- [Microsoft 학습의 SQL 콘텐츠](https://docs.microsoft.com/learn/browse/?products=azure-sql-database%2Csql-server&expanded=azure&WT.mc_id=academic-40229-cxa) ## 과제 -[Assignment Title](assignment.md) +[과제](assignment.md) diff --git a/2-Working-With-Data/translations/README.ko.md b/2-Working-With-Data/translations/README.ko.md index b321448b..7c294d53 100644 --- a/2-Working-With-Data/translations/README.ko.md +++ b/2-Working-With-Data/translations/README.ko.md @@ -1,6 +1,6 @@ # 데이터작업 -![데이터 사랑](images/data-love.jpg) +![데이터 사랑](../images/data-love.jpg) > 촬영작가: Alexander Sinn on Unsplash 이 수업에서는 응용 프로그램에서 데이터를 관리, 조작 및 사용할 수 있는 여러 방법에 대해 배웁니다. 또한 관계형 및 비관계형 데이터베이스에 대해 배우고 데이터가 이러한 데이터베이스에 어떻게 저장되는지 배웁니다. 파이썬으로 데이터를 다루는 기본 원리를 배우며, 이를 통해 데이터를 관리하고 마이닝(data mining) 할 수 있는 다양한 방법을 발견할 수 있을 것입니다. From f12d5ca1ed8fcc1c83f19cff26d4dc12b0baa7bf Mon Sep 17 00:00:00 2001 From: poo Date: Wed, 13 Oct 2021 18:02:09 +0900 Subject: [PATCH 04/13] ko: fix Relational Databases README(2) Signed-off-by: poo --- .../05-relational-databases/translations/README.ko.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2-Working-With-Data/05-relational-databases/translations/README.ko.md b/2-Working-With-Data/05-relational-databases/translations/README.ko.md index 1ec53461..22051b29 100644 --- a/2-Working-With-Data/05-relational-databases/translations/README.ko.md +++ b/2-Working-With-Data/05-relational-databases/translations/README.ko.md @@ -6,7 +6,7 @@ 과거에 스프레드 시트를 통해 정보를 저장한 경험이 있을 것입니다. 이는 행(rows)과 열(columns)을 가지고 있으며, 행(rows)에는 정보(혹은 데이터)를 나타내고 열(columns)에는 해당 정보(또는 메타데이터)를 정의합니다. 관계형 데이터베이스는 테이블의 행과 열의 핵심 원리를 기반으로 구축되며 여러 테이블에 정보를 분산시킬 수 있습니다. 이를 통해 더 복잡한 데이터를 다룰 수 있을 뿐만 아니라 중복을 방지하고, 데이터 탐색 방식에서 유연성을 가질 수 있습니다. 관계형 데이터베이스의 개념을 좀 더 살펴보겠습니다. -## [Pre-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/8) +## [강의 전 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/8) ## 모든 것의 시작 : 테이블(table) @@ -86,7 +86,7 @@ A relational database has at its core tables. 스프레드 시트와 마찬가 | 8 | 3 | 2019 | 942 | | 9 | 3 | 2020 | 1176 | -새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **외래 키(foreign key)**라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. +새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **외래키(foreign key)**라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. > ✅ 외래키(Foreign key)는 주로 FK라고 약칭합니다. @@ -125,7 +125,7 @@ WHERE country = 'New Zealand'; 우리는 이전까지 단일 테이블에서 데이터를 검색했습니다. 이제 도시(**city**)와 강수량(**rainfall**)의 데이터를 하나로 통합해 보여주려 합니다. 이것은 데이터 *조인*을 통해서 할 수 있습니다. 데이터 조인은 두개의 다른 테이블의 열을 일치시킴으로써 효과적으로 이어줍니다. -예를들어, 강수량(**rainfall) 테이블의 **city_id** 열과 도시(**city**) 테이블의 **city_id** 열을 매칭할 수 있습니다. 조인을 통해 각 도시들과 그에 맞는 강수량을 매칭할 것입니다. 여러 조인의 종류 중에서 먼저 다룰 것은 *inner* 조인입니다. *inner* 조인은 테이블간의 행이 정확하게 일치하지 않으면 표시되지 않습니다. 위의 예시의 경우 모든 도시에 비가 내리므로, 모든 행이 표시될 것입니다. +예를들어, 강수량(**rainfall**) 테이블의 **city_id** 열과 도시(**city**) 테이블의 **city_id** 열을 매칭할 수 있습니다. 조인을 통해 각 도시들과 그에 맞는 강수량을 매칭할 것입니다. 여러 조인의 종류 중에서 먼저 다룰 것은 *inner* 조인입니다. *inner* 조인은 테이블간의 행이 정확하게 일치하지 않으면 표시되지 않습니다. 위의 예시의 경우 모든 도시에 비가 내리므로, 모든 행이 표시될 것입니다. 그렇다면 모든 도시의 2019년 강수량을 보겠습니다. From e0a6b88e991af9d8a797dcbdd343f0f00beb63b0 Mon Sep 17 00:00:00 2001 From: poo Date: Wed, 13 Oct 2021 18:03:46 +0900 Subject: [PATCH 05/13] Fix typo Signed-off-by: poo --- .../05-relational-databases/translations/README.ko.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-Working-With-Data/05-relational-databases/translations/README.ko.md b/2-Working-With-Data/05-relational-databases/translations/README.ko.md index 22051b29..1e2ccf83 100644 --- a/2-Working-With-Data/05-relational-databases/translations/README.ko.md +++ b/2-Working-With-Data/05-relational-databases/translations/README.ko.md @@ -86,7 +86,7 @@ A relational database has at its core tables. 스프레드 시트와 마찬가 | 8 | 3 | 2019 | 942 | | 9 | 3 | 2020 | 1176 | -새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **외래키(foreign key)**라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. +새롭게 생성된 **강수량** 테이블의 **city_id** 열이 추가 되었습니다. 이 열은 **cities** 테이블의 참조 값(reference id)을 나타냅니다. 기술적 용어로 이것을, **외래키**(foreign key)라고 부릅니다; 이는 다른 테이블의 기본키입니다. 참조나 포인터의 개념이라고 생각할 수 있습니다. **city_id** 1은 Tokyo를 참조합니다. > ✅ 외래키(Foreign key)는 주로 FK라고 약칭합니다. From 07ff5965181ff6e4332446f8b0d2ee25b6d840df Mon Sep 17 00:00:00 2001 From: poo Date: Thu, 14 Oct 2021 15:56:02 +0900 Subject: [PATCH 06/13] ko:06-non-Relational README(1) Signed-off-by: poo --- .../translations/README.ko.md | 6 +- .../translations/README.ko.md | 150 ++++++++++++++++++ 2 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 2-Working-With-Data/06-non-relational/translations/README.ko.md diff --git a/2-Working-With-Data/05-relational-databases/translations/README.ko.md b/2-Working-With-Data/05-relational-databases/translations/README.ko.md index 1e2ccf83..cf77a3bb 100644 --- a/2-Working-With-Data/05-relational-databases/translations/README.ko.md +++ b/2-Working-With-Data/05-relational-databases/translations/README.ko.md @@ -1,8 +1,8 @@ -# 데이터 작업: 관계형 데이터베이스 +# 데이터 처리: 관계형 데이터베이스 |![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../../sketchnotes/05-RelationalData.png)| |:---:| -| 데이터 작업: 관계형 데이터베이스 - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | +| 데이터 처리: 관계형 데이터베이스 - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | 과거에 스프레드 시트를 통해 정보를 저장한 경험이 있을 것입니다. 이는 행(rows)과 열(columns)을 가지고 있으며, 행(rows)에는 정보(혹은 데이터)를 나타내고 열(columns)에는 해당 정보(또는 메타데이터)를 정의합니다. 관계형 데이터베이스는 테이블의 행과 열의 핵심 원리를 기반으로 구축되며 여러 테이블에 정보를 분산시킬 수 있습니다. 이를 통해 더 복잡한 데이터를 다룰 수 있을 뿐만 아니라 중복을 방지하고, 데이터 탐색 방식에서 유연성을 가질 수 있습니다. 관계형 데이터베이스의 개념을 좀 더 살펴보겠습니다. @@ -10,7 +10,7 @@ ## 모든 것의 시작 : 테이블(table) -A relational database has at its core tables. 스프레드 시트와 마찬가지로 테이블은 열과 행으로 이루어져 있습니다. 행에는 도시 이름이나 강우량등의 작업하고자 하는 데이터나 정보를 나타냅니다. 열에는 저장된 데이터에 대한 설명을 나타냅니다. +관계형 데이터베이스는 테이블을 가지며, 스프레드 시트와 마찬가지로 열과 행으로 이루어져 있습니다. 행에는 도시 이름이나 강우량등의 작업하고자 하는 데이터나 정보를 나타냅니다. 열에는 저장된 데이터에 대한 설명을 나타냅니다. 그렇다면 이제 실습을 시작해보겠습니다. 우선 도시 정보를 저장하는 테이블을 생성해 보도록 하겠습니다. 아래와 같이 나라와 도시 이름을 저장할 수 있을 것입니다.: diff --git a/2-Working-With-Data/06-non-relational/translations/README.ko.md b/2-Working-With-Data/06-non-relational/translations/README.ko.md new file mode 100644 index 00000000..d4aea0a5 --- /dev/null +++ b/2-Working-With-Data/06-non-relational/translations/README.ko.md @@ -0,0 +1,150 @@ +# 데이터 처리: 비-관계형 데이터 + +|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../../sketchnotes/06-NoSQL.png)| +|:---:| +|데이터 처리: NoSQL 데이터 - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | + +## [강의 전 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/10) + +데이터는 관계형 데이터베이스에만 국한되지 않습니다. 이 과정을 통해 비-관계형 데이터에 초점을 맞춰 스프레드시트와 NoSQL의 기초에 대해 설명하겠습니다. + +## 스프레드시트 + +스프레드시트는 설정 및 시작에 필요한 작업량이 적기 때문에 데이터를 저장하거나 탐색하는 일반적인 방법입니다. 이 과정에서는 공식 및 함수뿐만 아니라 스프레드시트의 기본 구성요소에 대해 알아보겠습니다. 예시들은 Microsoft Excel에서 다룰 것이며, 대부분의 다른 스프레드시트 소프트웨어 또한 유사한 이름과 단계들을 가지고 있습니다. + +![An empty Microsoft Excel workbook with two worksheets](../images/parts-of-spreadsheet.png) + +스프레드시트는 하나의 파일이며, 컴퓨터, 장치, 클라우드 기반 파일 시스템에서 접근할 수 있습니다. 소프트웨어 자체로써 브라우저 기반이거나 컴퓨터나 앱에서 다운로드해야 하는 응용 프로그램일 수도 있습니다. 엑셀에서 이러한 파일은 **워크북**이라고 적의되며, 이 과정의 나머지 부분에서 다시 설명하도록 하겠습니다. + +워크북은 하나 이상의 **워크시트**가 포함되며, 각 워크시트에는 탭으로 레이블이 지정됩니다. 워크시트에는 **셀**이라 불리는 사각형이 있고, 실제 데이터가 여기에 들어가게 됩니다. 셀은 행과 열의 교차하며 열에는 알파벳 문자의 레이블, 행에는 숫자 레이블이 지정됩니다. 일부 스프레드시트는 처음 몇 행에 셀의 데이터를 설명하는 머릿글이 위치할 수도 있습니다. + +엑셀 워크북의 기본 요소를 사용하며 스프레드시트의 몇가지 추가적인 기능을 살펴보기 위해서, 재고를 다루는 [마이크로소프트 템플릿](https://templates.office.com/)에서 제공하는 몇 가지 예제를 사용하겠습니다. + +### 재고 관리 + +"재고 예시"라는 스프레드시트 파일은 세 개의 워크시트를 가지고 있는 재고 목록의 형식화된 스프레드시트입니다. 탭에는 "재고 목록", "선택한 재고 목록", "Bin 조회" 레이블을 가지고 있습니다. 재고 목록 워크시트의 4행은 각 셀의 값을 설명하는 머리글입니다. + +![A highlighted formula from an example inventory list in Microsoft Excel](../images/formula-excel.png) + +위의 예시 중 어떤 셀은 값을 생성하기 위해 다른 셀의 값에 의존하기도 합니다. 재고 목록 스프레드시트는 재고에 대한 단가는 가지고 있지만, 만약 우리가 재고의 전체적인 비용을 알아야 한다면 어떻게 할까? 이 예에서 [**공식**](https://support.microsoft.com/en-us/office/overview-of-formulas-34519a4e-1e8d-4f4b-84d4-d642c4f63263) 셀 데이터에 대해 계산을 수행하고 재고 비용을 계산하는 데 사용됩니다. 이 스프레드시트는 재고 비용 열의 공식을 사용해 QTY 헤더에 따른 수량과 COST 헤더에 따른 단가를 곱해 각 항목의 값을 계산했습니다. 셀을 두 번 클릭하거나 강조 표시하면 공식이 표시됩니다. 공식은 등호 다음에 계산 또는 연산으로 시작합니다. + +![A highlighted function from an example inventory list in Microsoft Excel](../images/function-excel.png) + +우리는 재고 비용의 모든 값을 더한 총 합계를 구하기 위해 다른 공식을 사용할 수도 있습니다. 총 합계를 계산하기 위해 각각의 셀을 추가해 계산할 수도 있지만, 이것은 너무 지루한 작업입니다. 이 같은 문제를 해결하기 위해 엑셀은 [**함수**](https://support.microsoft.com/en-us/office/sum-function-043e1c7d-7726-4e80-8f32-07b23e057f89), 또는 셀 값에 대한 계산을 수행하기 위한 사전에 정의된 공식을 가지고 있습니다. 함수는 이러한 계산을 수행하는 데 필요한 값인 인수가 필요합니다. 함수에 둘 이상의 인수가 필요한 경우, 인수가 특정 순서로 나열되지 않는다면 올바른 값이 도출되지 않을 수 있습니다. 이 예제에서는 SUM 함수를 사용하겠습니다. 재고 값들을 인수로 사용해, 3행 B열(또는 B3)에 나열된 합계를 추가합니다. + +## NoSQL + +NoSQL은 비관계적 데이터를 저장하는 다양한 방법을 포괄적으로 지칭하는 용어이며, "비SQL", "비-관계적" 또는 "SQL의 확장"으로 해석될 수 있다. 이러한 유형의 데이터베이스 시스템은 4가지 유형으로 분류할 수 있습니다. + +![Graphical representation of a key-value data store showing 4 unique numerical keys that are associated with 4 various values](../images/kv-db.png) +> 출처: [Michał Białecki Blog](https://www.michalbialecki.com/2018/03/18/azure-cosmos-db-key-value-database-cloud/) + +[키-값](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#keyvalue-data-stores) databases pair unique keys, which are a unique identifier associated with a value. These pairs are stored using a [hash table](https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/tutorial/) with an appropriate hashing function. + + +![Graphical representation of a graph data store showing the relationships between people, their interests and locations](../images/graph-db.png) +> 출처: [Microsoft](https://docs.microsoft.com/en-us/azure/cosmos-db/graph/graph-introduction#graph-database-by-example) + +[그래프](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#graph-data-stores) databases describe relationships in data and are represented as a collection of nodes and edges. A node represents an entity, something that exists in the real world such as a student or bank statement. Edges represent the relationship between two entities Each node and edge have properties that provides additional information about each node and edges. + +![Graphical representation of a columnar data store showing a customer database with two column families named Identity and Contact Info](../images/columnar-db.png) + +[열 기반](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#columnar-data-stores) data stores organizes data into columns and rows like a relational data structure but each column is divided into groups called a column family, where the all the data under one column is related and can be retrieved and changed in one unit. + + +### Document Data Stores with the Azure Cosmos DB + +[Document](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#document-data-stores) data stores build on the concept of a key-value data store and is made up of a series of fields and objects. This section will explore document databases with the Cosmos DB emulator. + +A Cosmos DB database fits the definition of "Not Only SQL", where Cosmos DB's document database relies on SQL to query the data. The [previous lesson](../../05-relational-databases/README.md) on SQL covers the basics of the language, and we'll be able to apply some of the same queries to a document database here. We'll be using the Cosmos DB Emulator, which allows us to create and explore a document database locally on a computer. Read more about the Emulator [here](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21). + +A document is a collection of fields and object values, where the fields describe what the object value represents. Below is an example of a document. + +```json +{ + "firstname": "Eva", + "age": 44, + "id": "8c74a315-aebf-4a16-bb38-2430a9896ce5", + "_rid": "bHwDAPQz8s0BAAAAAAAAAA==", + "_self": "dbs/bHwDAA==/colls/bHwDAPQz8s0=/docs/bHwDAPQz8s0BAAAAAAAAAA==/", + "_etag": "\"00000000-0000-0000-9f95-010a691e01d7\"", + "_attachments": "attachments/", + "_ts": 1630544034 +} +``` + +The fields of interest in this document are: `firstname`, `id`, and `age`. The rest of the fields with the underscores were generated by Cosmos DB. + +#### Exploring Data with the Cosmos DB Emulator + +You can download and install the emulator [for Windows here](https://aka.ms/cosmosdb-emulator). Refer to this [documentation](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21#run-on-linux-macos) for options on how to run the Emulator for macOS and Linux. + +The Emulator launches a browser window, where the Explorer view allows you to explore documents. + +![The Explorer view of the Cosmos DB Emulator](images/cosmosdb-emulator-explorer.png) + +If you're following along, click on "Start with Sample" to generate a sample database called SampleDB. If you expand Sample DB by clicking on the arrow you'll find a container called `Persons`, a container holds a collection of items, which are the documents within the container. You can explore the four individual documents under `Items`. + +![Exploring sample data in the Cosmos DB Emulator](images/cosmosdb-emulator-persons.png) + +#### Querying Document Data with the Cosmos DB Emulator + +We can also query the sample data by clicking on the new SQL Query button (second button from the left). + +`SELECT * FROM c` returns all the documents in the container. Let's add a where clause and find everyone younger than 40. + +`SELECT * FROM c where c.age < 40` + + ![Running a SELECT query on sample data in the Cosmos DB Emulator to find documents that have an age field value that is less than 40](images/cosmosdb-emulator-persons-query.png) + +The query returns two documents, notice the age value for each document is less than 40. + +#### JSON and Documents + +If you're familiar with JavaScript Object Notation (JSON) you'll notice that documents look similar to JSON. There is a `PersonsData.json` file in this directory with more data that you may upload to the Persons container in the Emulator via the `Upload Item` button. + +In most instances, APIs that return JSON data can be directly transferred and stored in document databases. Below is another document, it represents tweets from the Microsoft Twitter account that was retrieved using the Twitter API, then inserted into Cosmos DB. + +```json +{ + "created_at": "2021-08-31T19:03:01.000Z", + "id": "1432780985872142341", + "text": "Blank slate. Like this tweet if you’ve ever painted in Microsoft Paint before. https://t.co/cFeEs8eOPK", + "_rid": "dhAmAIUsA4oHAAAAAAAAAA==", + "_self": "dbs/dhAmAA==/colls/dhAmAIUsA4o=/docs/dhAmAIUsA4oHAAAAAAAAAA==/", + "_etag": "\"00000000-0000-0000-9f84-a0958ad901d7\"", + "_attachments": "attachments/", + "_ts": 1630537000 +``` + +The fields of interest in this document are: `created_at`, `id`, and `text`. + +## 🚀 Challenge + + +There is a `TwitterData.json` file that you can upload to the SampleDB database. It's recommended that you add it to a separate container. This can be done by: + +1. Clicking the new container button in the top right +1. Selecting the existing database (SampleDB) creating a container id for the container +1. Setting the partition key to `/id` +1. Clicking OK (you can ignore rest of the information in this view as this is a small dataset running locally on your machine) +1. Open your new container and upload the Twitter Data file with `Upload Item` button + +Try to run a few select queries to find the documents that have Microsoft in the text field. Hint: try to use the [LIKE keyword](https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-query-keywords#using-like-with-the--wildcard-character) + + +## [Post-Lecture Quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/11) + + + +## Review & Self Study + +- There are some additional formatting and features added to this spreadsheet that this lesson does not cover. Microsoft has a [large library of documentation and videos](https://support.microsoft.com/excel) on Excel if you're interested in learning more. + +- This architectural documentation details the characteristics in the different types of non-relational data: [Non-relational Data and NoSQL](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data) + +- Cosmos DB is a cloud based non-relational database that can also store the different NoSQL types mentioned in this lesson. Learn more about these types in this [Cosmos DB Microsoft Learn Module](https://docs.microsoft.com/en-us/learn/paths/work-with-nosql-data-in-azure-cosmos-db/) + +## Assignment + +[Soda Profits](assignment.md) From 75aff8a9bff47265913b6a60a223e6f3f8a8852e Mon Sep 17 00:00:00 2001 From: poo Date: Tue, 7 Dec 2021 16:22:26 +0900 Subject: [PATCH 07/13] ko:06-non-Relational README(2) Signed-off-by: poo --- .../translations/README.ko.md | 83 +++++++++---------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/2-Working-With-Data/06-non-relational/translations/README.ko.md b/2-Working-With-Data/06-non-relational/translations/README.ko.md index d4aea0a5..1435fa76 100644 --- a/2-Working-With-Data/06-non-relational/translations/README.ko.md +++ b/2-Working-With-Data/06-non-relational/translations/README.ko.md @@ -14,7 +14,7 @@ ![An empty Microsoft Excel workbook with two worksheets](../images/parts-of-spreadsheet.png) -스프레드시트는 하나의 파일이며, 컴퓨터, 장치, 클라우드 기반 파일 시스템에서 접근할 수 있습니다. 소프트웨어 자체로써 브라우저 기반이거나 컴퓨터나 앱에서 다운로드해야 하는 응용 프로그램일 수도 있습니다. 엑셀에서 이러한 파일은 **워크북**이라고 적의되며, 이 과정의 나머지 부분에서 다시 설명하도록 하겠습니다. +스프레드시트는 하나의 파일이며, 컴퓨터, 장치, 클라우드 기반 파일 시스템에서 접근할 수 있습니다. 소프트웨어 자체로써 브라우저 기반이거나 컴퓨터나 앱에서 다운로드해야 하는 응용 프로그램일 수도 있습니다. 엑셀에서 이러한 파일은 **워크북**이라고 정의되며, 이 과정의 나머지 부분에서 다시 설명하도록 하겠습니다. 워크북은 하나 이상의 **워크시트**가 포함되며, 각 워크시트에는 탭으로 레이블이 지정됩니다. 워크시트에는 **셀**이라 불리는 사각형이 있고, 실제 데이터가 여기에 들어가게 됩니다. 셀은 행과 열의 교차하며 열에는 알파벳 문자의 레이블, 행에는 숫자 레이블이 지정됩니다. 일부 스프레드시트는 처음 몇 행에 셀의 데이터를 설명하는 머릿글이 위치할 수도 있습니다. @@ -37,28 +37,27 @@ NoSQL은 비관계적 데이터를 저장하는 다양한 방법을 포괄적으로 지칭하는 용어이며, "비SQL", "비-관계적" 또는 "SQL의 확장"으로 해석될 수 있다. 이러한 유형의 데이터베이스 시스템은 4가지 유형으로 분류할 수 있습니다. ![Graphical representation of a key-value data store showing 4 unique numerical keys that are associated with 4 various values](../images/kv-db.png) -> 출처: [Michał Białecki Blog](https://www.michalbialecki.com/2018/03/18/azure-cosmos-db-key-value-database-cloud/) +> 출처: [Michał Białecki 블로그](https://www.michalbialecki.com/2018/03/18/azure-cosmos-db-key-value-database-cloud/) -[키-값](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#keyvalue-data-stores) databases pair unique keys, which are a unique identifier associated with a value. These pairs are stored using a [hash table](https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/tutorial/) with an appropriate hashing function. +[키-값](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#keyvalue-data-stores) 데이터베이스는 값과 연결된 고유 식별자인 고유 키를 쌍으로 구성합니다. 이러한 쌍들은 해시 함수를 사용하여 [해시 테이블](https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/tutorial/)에 저장됩니다. ![Graphical representation of a graph data store showing the relationships between people, their interests and locations](../images/graph-db.png) > 출처: [Microsoft](https://docs.microsoft.com/en-us/azure/cosmos-db/graph/graph-introduction#graph-database-by-example) -[그래프](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#graph-data-stores) databases describe relationships in data and are represented as a collection of nodes and edges. A node represents an entity, something that exists in the real world such as a student or bank statement. Edges represent the relationship between two entities Each node and edge have properties that provides additional information about each node and edges. +[그래프](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#graph-data-stores) 데이터베이스는 데이터의 관계를 설명하고 노드(node)와 엣지(edge)의 집합으로 표현됩니다. 노드는 학생 또는 은행 명세서처럼 실제 세계에 존재하는 엔티티를 나타냅니다. 엣지는 두 엔티티간의 관계를 나타냅니다. 각 노드와 가장자리는 각각에 대한 추가 정보를 제공하는 속성을 가지고 있습니다. ![Graphical representation of a columnar data store showing a customer database with two column families named Identity and Contact Info](../images/columnar-db.png) -[열 기반](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#columnar-data-stores) data stores organizes data into columns and rows like a relational data structure but each column is divided into groups called a column family, where the all the data under one column is related and can be retrieved and changed in one unit. +[컬럼 기반](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#columnar-data-stores) 데이터 스토어는 데이터를 관계형 데이터 구조처럼 열과 행으로 구성하지만, 각 열은 컬럼패밀리(column family)라 불리는 그룹으로 나뉘며, 한 컬럼 아래의 모든 데이터가 관련되 하나의 단위로 검색 및 변경할 수 있습니다. +### Azure Cosmos DB를 사용한 문서 데이터 저장소 -### Document Data Stores with the Azure Cosmos DB +[문서](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#document-data-stores) 데이터 저장소는 키 값 데이터 저장소의 개념을 기반으로 하며, 일련의 필드와 객체로 구성됩니다. 이 섹션에서는 Cosmos DB 에뮬레이터를 사용하여 문서 데이터베이스를 살펴봅니다. -[Document](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data#document-data-stores) data stores build on the concept of a key-value data store and is made up of a series of fields and objects. This section will explore document databases with the Cosmos DB emulator. +Cosmos DB 데이터베이스는 "Not Only SQL"의 정의에 부합하며, 여기서 Cosmos DB의 문서 데이터베이스는 SQL에 의존하여 데이터를 쿼리합니다. SQL에 대한 [이전 과정](../../05-relational-databases/README.md)에서는 언어의 기본 사항에 대해 설명하며 여기서 동일한 쿼리 중 일부를 문서 데이터베이스에 적용할 수 있습니다. 우리는 컴퓨터에서 로컬로 문서 데이터베이스를 만들고 탐색할 수 있는 Cosmos DB 에뮬레이터를 사용할 것입니다. 에뮬레이터에 관해서는 [이곳](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21)에서 더 자세히 알아보세요. -A Cosmos DB database fits the definition of "Not Only SQL", where Cosmos DB's document database relies on SQL to query the data. The [previous lesson](../../05-relational-databases/README.md) on SQL covers the basics of the language, and we'll be able to apply some of the same queries to a document database here. We'll be using the Cosmos DB Emulator, which allows us to create and explore a document database locally on a computer. Read more about the Emulator [here](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21). - -A document is a collection of fields and object values, where the fields describe what the object value represents. Below is an example of a document. +문서는 필드 및 오브젝트 값의 집합으로, 여기서 필드는 오브젝트 값이 나타내는 것을 설명합니다. 아래는 문서의 예시입니다. ```json { @@ -73,37 +72,38 @@ A document is a collection of fields and object values, where the fields describ } ``` -The fields of interest in this document are: `firstname`, `id`, and `age`. The rest of the fields with the underscores were generated by Cosmos DB. +이 문서의 관심 필드는 `firstname`, `id`, 그리고 `age` 입니다. 밑줄이 있는 나머지 필드는 Cosmos DB에서 생성되었습니다. -#### Exploring Data with the Cosmos DB Emulator +#### Cosmos DB 에뮬레이터를 이용한 데이터 탐색 -You can download and install the emulator [for Windows here](https://aka.ms/cosmosdb-emulator). Refer to this [documentation](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21#run-on-linux-macos) for options on how to run the Emulator for macOS and Linux. +당신은 [이곳](https://aka.ms/cosmosdb-emulator)에서 윈도우 전용 에뮬레이터를 다운로드하여 설치할 수 있습니다. macOS 및 Linux용 에뮬레이터를 실행하는 방법은 이 [설명서](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21#run-on-linux-macos)를 참조하세요. -The Emulator launches a browser window, where the Explorer view allows you to explore documents. +에뮬레이터는 탐색기 보기를 통해 문서를 탐색할 수 있는 브라우저 창을 실행합니다. -![The Explorer view of the Cosmos DB Emulator](images/cosmosdb-emulator-explorer.png) +![The Explorer view of the Cosmos DB Emulator](../images/cosmosdb-emulator-explorer.png) -If you're following along, click on "Start with Sample" to generate a sample database called SampleDB. If you expand Sample DB by clicking on the arrow you'll find a container called `Persons`, a container holds a collection of items, which are the documents within the container. You can explore the four individual documents under `Items`. +다음은 "샘플부터 시작(Start with Sample)"을 클릭하여 샘플DB(SampleDB)라고 불리는 샘플 데이터베이스를 +생성합니다. 화살표를 클릭하여 샘플 DB를 확장하게 되면, 컨테이너 안에 있는 문서인 항목들을 모아둔 `사람`이라는 컨테이너가 있습니다. 당신은 이제 `항목` 아래에 있는 4개의 개별문서들을 탐색할 수 있습니다. -![Exploring sample data in the Cosmos DB Emulator](images/cosmosdb-emulator-persons.png) +![Exploring sample data in the Cosmos DB Emulator](../images/cosmosdb-emulator-persons.png) -#### Querying Document Data with the Cosmos DB Emulator +#### Cosmos DB 에뮬레이터를 사용한 문서 데이터 쿼리 -We can also query the sample data by clicking on the new SQL Query button (second button from the left). +우리는 또한 새로운 SQL Query 버튼(왼쪽에서 2번째 버튼)을 클릭하여 샘플 데이터를 조회할 수 있습니다. -`SELECT * FROM c` returns all the documents in the container. Let's add a where clause and find everyone younger than 40. +`SELECT * FROM c` 는 컨테이너에 있는 모든 문서를 반환합니다. `WHERE` 절을 추가하고 40세 이하의 모든 사람을 찾아봅시다! `SELECT * FROM c where c.age < 40` - ![Running a SELECT query on sample data in the Cosmos DB Emulator to find documents that have an age field value that is less than 40](images/cosmosdb-emulator-persons-query.png) + ![Running a SELECT query on sample data in the Cosmos DB Emulator to find documents that have an age field value that is less than 40](../images/cosmosdb-emulator-persons-query.png) -The query returns two documents, notice the age value for each document is less than 40. +이 쿼리는 나이에 대한 값이 40보다 작은 두 개의 문서를 반환합니다. -#### JSON and Documents +#### JSON 과 문서들 -If you're familiar with JavaScript Object Notation (JSON) you'll notice that documents look similar to JSON. There is a `PersonsData.json` file in this directory with more data that you may upload to the Persons container in the Emulator via the `Upload Item` button. +만약 당신이 JavaScript Object Notation (JSON)에 익숙한 경우 문서가 JSON과 유사하다는 것을 알 수 있습니다. 이 디렉토리에는 `항목 업로드` 버튼을 통해 에뮬레이터의 사용자 컨테이너에 업로드할 수 있는 더 많은 데이터가 포함된 `PersonData.json` 파일이 있습니다. -In most instances, APIs that return JSON data can be directly transferred and stored in document databases. Below is another document, it represents tweets from the Microsoft Twitter account that was retrieved using the Twitter API, then inserted into Cosmos DB. +대부분의 경우 JSON 데이터를 반환하는 API는 문서 데이터 베이스에 직접 전송 및 저장할 수 있습니다. 아래는 트위터 API를 사용하여 검색된 마이크로소프트 트위터 계정의 트윗을 나타낸 문서이며 Cosmos DB에 삽입되었습니다. ```json { @@ -117,34 +117,33 @@ In most instances, APIs that return JSON data can be directly transferred and st "_ts": 1630537000 ``` -The fields of interest in this document are: `created_at`, `id`, and `text`. - -## 🚀 Challenge +이 문서의 관심 필드는 `created_at`, `id`, 그리고 `text` 입니다. +## 🚀 과제 -There is a `TwitterData.json` file that you can upload to the SampleDB database. It's recommended that you add it to a separate container. This can be done by: +샘플 DB 데이터베이스에 업로드할 수 있는 `TwitterData.json` 파일이 있습니다. 별도의 컨테이너에 추가하는 것을 추천합니다. 이 작업은 다음에 따라 수행할 수 있습니다.: -1. Clicking the new container button in the top right -1. Selecting the existing database (SampleDB) creating a container id for the container -1. Setting the partition key to `/id` -1. Clicking OK (you can ignore rest of the information in this view as this is a small dataset running locally on your machine) -1. Open your new container and upload the Twitter Data file with `Upload Item` button +1. 오른쪽 상단에 있는 새 컨테이너 버튼을 클릭합니다. +1. 컨테이너에 대한 컨테이너 id 를 작성하는 기존 데이터베이스(Sample DB)를 선택합니다. +1. 파티션 키를 `/id`로 설정합니다. +1. OK(확인)를 클릭합니다.(이 보기의 나머지 정보는 컴퓨터에서 로컬로 실행되는 작은 데이터 집합이므로 무시할 수 있습니다.) +1. 새 컨테이너를 열고 `항목업로드`버튼으로 트위터 데이터 파일을 업로드합니다. -Try to run a few select queries to find the documents that have Microsoft in the text field. Hint: try to use the [LIKE keyword](https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-query-keywords#using-like-with-the--wildcard-character) +텍스트 필드에 Microsoft가 있는 문서를 찾기 위해 몇 가지 쿼리를 실행해 보십시오. 힌트: [LIKE 키워드](https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-query-keywords#using-like-with-the--wildcard-character)를 사용해 보십시오. -## [Post-Lecture Quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/11) +## [강의 후 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/11) -## Review & Self Study +## 리뷰 & 복습 -- There are some additional formatting and features added to this spreadsheet that this lesson does not cover. Microsoft has a [large library of documentation and videos](https://support.microsoft.com/excel) on Excel if you're interested in learning more. +- 이 과정에서는 다루지 않는 일부 추가 형식 및 기능이 이 스프레드쉬트에 추가되었습니다. 마이크로 소프트는 흥미를 가질만한 엑셀에 대한 [많은 영상과 문서들](https://support.microsoft.com/excel)을 가지고 있습니다. -- This architectural documentation details the characteristics in the different types of non-relational data: [Non-relational Data and NoSQL](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data) +- 이 아키텍처 문서에는 여러 유형의 비관계형 데이터의 특성이 자세히 나와 있습니다: [비-관계형 데이터와 NoSQL](https://docs.microsoft.com/en-us/azure/architecture/data-guide/big-data/non-relational-data) -- Cosmos DB is a cloud based non-relational database that can also store the different NoSQL types mentioned in this lesson. Learn more about these types in this [Cosmos DB Microsoft Learn Module](https://docs.microsoft.com/en-us/learn/paths/work-with-nosql-data-in-azure-cosmos-db/) +- Cosmos DB는 클라우드 기반 비관계형 데이터베이스로, 이 과정에서 언급한 다양한 NoSQL 유형도 저장할 수 있습니다. [Cosmos DB Microsoft 학습 모듈](https://docs.microsoft.com/en-us/learn/paths/work-with-nosql-data-in-azure-cosmos-db/)에서 이러한 유형에 대해 자세히 알아보세요. -## Assignment +## 과제 -[Soda Profits](assignment.md) +[탄산음료 수익](assignment.md) From 7c0703ab482bb436b19c450aac303f804b0ef179 Mon Sep 17 00:00:00 2001 From: poo Date: Tue, 7 Dec 2021 18:17:14 +0900 Subject: [PATCH 08/13] ko:07-python README(1) Signed-off-by: poo --- .../07-python/translations/README.ko.md | 282 ++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 2-Working-With-Data/07-python/translations/README.ko.md diff --git a/2-Working-With-Data/07-python/translations/README.ko.md b/2-Working-With-Data/07-python/translations/README.ko.md new file mode 100644 index 00000000..10f74015 --- /dev/null +++ b/2-Working-With-Data/07-python/translations/README.ko.md @@ -0,0 +1,282 @@ +# 데이터 처리: Python and Panda 라이브러리 + +| ![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../../sketchnotes/07-WorkWithPython.png) | +| :-------------------------------------------------------------------------------------------------------: | +| 데이터처리: 파이썬(python) - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | + +[![Intro Video](../images/video-ds-python.png)](https://youtu.be/dZjWOGbsN4Y) + +데이터베이스가 질의 언어를 사용하여 데이터를 저장하고 쿼리하는 매우 효율적인 방법을 제공하지만, 데이터 처리의 가장 유연한 방법은 데이터를 조작하기 위해 자신만의 프로그램을 작성하는 것입니다. 대부분의 경우 데이터베이스 쿼리를 수행하는 것이 더 효과적인 방법입니다. 그러나 더 복잡한 데이터 처리가 필요한 경우 SQL을 사용하여 쉽게 처리할 수 없습니다. +데이터 처리는 어떤 프로그래밍 언어로도 프로그래밍이 가능하지만, 데이터 작업에 있어서 더 유용한 언어가 있습니다. 데이터 과학자는 일반적으로 다음 언어 중 하나를 선호합니다: + +* **[Python(파이썬)](https://www.python.org/)** 은 범용 프로그래밍 언어로 간단하기 때문에 초보자를 위한 최고의 선택지 중 하나입니다. 파이썬(python)에는 ZIP 아카이브에서 데이터를 추출하거나 그림을 흑백으로 변환하는 것과 같은 실제 문제를 해결하는 데 도움이 되는 많은 추가 라이브러리가 존재합니다. 게다가, 데이터 과학 외에도 파이썬은 웹 개발에도 많이 사용됩니다. +* **[R(알)](https://www.r-project.org/)** 은 통계 데이터 처리를 염두에 두고 개발된 전통적인 도구 상자입니다. 또한 대규모 라이브러리 저장소(CRAN)를 포함하고 있어 데이터 처리에 적합합니다. 그러나, R은 범용 프로그래밍 언어가 아니며 데이터 과학 영역 밖에서는 거의 사용되지 않습니다. +* **[Julia(줄리아)](https://julialang.org/)** 데이터 과학을 위해 특별히 개발된 또 다른 언어이다. 이것은 파이썬보다 더 나은 성능을 제공하기 위한 것으로 과학 실험을 위한 훌륭한 도구입니다. + +이 과정에서는 간단한 데이터 처리를 위해 파이썬을 사용하는 것에 초점을 맞출 것입니다. 사전에 파이썬에 익숙해질 필요가 있습니다. 파이썬에 대해 더 자세히 살펴보고 싶다면 다음 리소스 중 하나를 참조할 수 있습니다: + +* [Turtle Graphics와 Fractal로 Python을 재미있게 배우기](https://github.com/shwars/pycourse) - GitHub 기반 Python 프로그래밍에 대한 빠른 소개 과정 +* [Python으로 첫 걸음 내딛기](https://docs.microsoft.com/en-us/learn/paths/python-first-steps/?WT.mc_id=academic-31812-dmitryso) - [Microsoft 학습](http://learn.microsoft.com/?WT.mc_id=academic-31812-dmitryso)으로 이동하기 + +데이터는 다양한 형태로 나타날 수 있습니다. 이 과정에서 우리는 세 가지 형태의 데이터를 고려할 것입니다. - **표로 나타낸 데이터(tabular data)**, **텍스트(text)** and **이미지(images)**. + +모든 관련 라이브러리에 대한 전체 개요를 제공하는 대신 데이터 처리의 몇 가지 예를 중점적으로 살펴보겠습니다. 이를 통해 무엇이 가능한지에 대한 주요 아이디어를 얻을 수 있으며, 필요할 때 문제에 대한 해결책을 찾을 수 있는 방도를 파악할 수 있습니다. + +> **유용한 Tip**. 방법을 모르는 데이터에 대해 특정 작업을 수행해야 할 경우 인터넷에서 검색해 보십시오. [스택오버플로우](https://stackoverflow.com/)는 일반적으로 많은 일반적인 작업을 위해 다양한 파이썬의 유용한 코드 샘플을 가지고 있습니다. + + + +## [Pre-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/12) + +## Tabular Data and Dataframes + +You have already met tabular data when we talked about relational databases. When you have a lot of data, and it is contained in many different linked tables, it definitely makes sense to use SQL for working with it. However, there are many cases when we have a table of data, and we need to gain some **understanding** or **insights** about this data, such as the distribution, correlation between values, etc. In data science, there are a lot of cases when we need to perform some transformations of the original data, followed by visualization. Both those steps can be easily done using Python. + +There are two most useful libraries in Python that can help you deal with tabular data: +* **[Pandas](https://pandas.pydata.org/)** allows you to manipulate so-called **Dataframes**, which are analogous to relational tables. You can have named columns, and perform different operations on row, columns and dataframes in general. +* **[Numpy](https://numpy.org/)** is a library for working with **tensors**, i.e. multi-dimensional **arrays**. Array has values of the same underlying type, and it is simpler than dataframe, but it offers more mathematical operations, and creates less overhead. + +There are also a couple of other libraries you should know about: +* **[Matplotlib](https://matplotlib.org/)** is a library used for data visualization and plotting graphs +* **[SciPy](https://www.scipy.org/)** is a library with some additional scientific functions. We have already come across this library when talking about probability and statistics + +Here is a piece of code that you would typically use to import those libraries in the beginning of your Python program: +```python +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +from scipy import ... # you need to specify exact sub-packages that you need +``` + +Pandas is centered around a few basic concepts. + +### Series + +**Series** is a sequence of values, similar to a list or numpy array. The main difference is that series also has an **index**, and when we operate on series (eg., add them), the index is taken into account. Index can be as simple as integer row number (it is the index used by default when creating a series from list or array), or it can have a complex structure, such as date interval. + +> **Note**: There is some introductory Pandas code in the accompanying notebook [`notebook.ipynb`](notebook.ipynb). We only outline some the examples here, and you are definitely welcome to check out the full notebook. + +Consider an example: we want to analyze sales of our ice-cream spot. Let's generate a series of sales numbers (number of items sold each day) for some time period: + +```python +start_date = "Jan 1, 2020" +end_date = "Mar 31, 2020" +idx = pd.date_range(start_date,end_date) +print(f"Length of index is {len(idx)}") +items_sold = pd.Series(np.random.randint(25,50,size=len(idx)),index=idx) +items_sold.plot() +``` +![Time Series Plot](images/timeseries-1.png) + +Now suppose that each week we are organizing a party for friends, and we take additional 10 packs of ice-cream for a party. We can create another series, indexed by week, to demonstrate that: +```python +additional_items = pd.Series(10,index=pd.date_range(start_date,end_date,freq="W")) +``` +When we add two series together, we get total number: +```python +total_items = items_sold.add(additional_items,fill_value=0) +total_items.plot() +``` +![Time Series Plot](images/timeseries-2.png) + +> **Note** that we are not using simple syntax `total_items+additional_items`. If we did, we would have received a lot of `NaN` (*Not a Number*) values in the resulting series. This is because there are missing values for some of the index point in the `additional_items` series, and adding `Nan` to anything results in `NaN`. Thus we need to specify `fill_value` parameter during addition. + +With time series, we can also **resample** the series with different time intervals. For example, suppose we want to compute mean sales volume monthly. We can use the following code: +```python +monthly = total_items.resample("1M").mean() +ax = monthly.plot(kind='bar') +``` +![Monthly Time Series Averages](images/timeseries-3.png) + +### DataFrame + +A DataFrame is essentially a collection of series with the same index. We can combine several series together into a DataFrame: +```python +a = pd.Series(range(1,10)) +b = pd.Series(["I","like","to","play","games","and","will","not","change"],index=range(0,9)) +df = pd.DataFrame([a,b]) +``` +This will create a horizontal table like this: +| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | +| --- | --- | ---- | --- | --- | ------ | --- | ------ | ---- | ---- | +| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | +| 1 | I | like | to | use | Python | and | Pandas | very | much | + +We can also use Series as columns, and specify column names using dictionary: +```python +df = pd.DataFrame({ 'A' : a, 'B' : b }) +``` +This will give us a table like this: + +| | A | B | +| --- | --- | ------ | +| 0 | 1 | I | +| 1 | 2 | like | +| 2 | 3 | to | +| 3 | 4 | use | +| 4 | 5 | Python | +| 5 | 6 | and | +| 6 | 7 | Pandas | +| 7 | 8 | very | +| 8 | 9 | much | + +**Note** that we can also get this table layout by transposing the previous table, eg. by writing +```python +df = pd.DataFrame([a,b]).T..rename(columns={ 0 : 'A', 1 : 'B' }) +``` +Here `.T` means the operation of transposing the DataFrame, i.e. changing rows and columns, and `rename` operation allows us to rename columns to match the previous example. + +Here are a few most important operations we can perform on DataFrames: + +**Column selection**. We can select individual columns by writing `df['A']` - this operation returns a Series. We can also select a subset of columns into another DataFrame by writing `df[['B','A']]` - this return another DataFrame. + +**Filtering** only certain rows by criteria. For example, to leave only rows with column `A` greater than 5, we can write `df[df['A']>5]`. + +> **Note**: The way filtering works is the following. The expression `df['A']<5` returns a boolean series, which indicates whether expression is `True` or `False` for each element of the original series `df['A']`. When boolean series is used as an index, it returns subset of rows in the DataFrame. Thus it is not possible to use arbitrary Python boolean expression, for example, writing `df[df['A']>5 and df['A']<7]` would be wrong. Instead, you should use special `&` operation on boolean series, writing `df[(df['A']>5) & (df['A']<7)]` (*brackets are important here*). + +**Creating new computable columns**. We can easily create new computable columns for our DataFrame by using intuitive expression like this: +```python +df['DivA'] = df['A']-df['A'].mean() +``` +This example calculates divergence of A from its mean value. What actually happens here is we are computing a series, and then assigning this series to the left-hand-side, creating another column. Thus, we cannot use any operations that are not compatible with series, for example, the code below is wrong: +```python +# Wrong code -> df['ADescr'] = "Low" if df['A'] < 5 else "Hi" +df['LenB'] = len(df['B']) # <- Wrong result +``` +The latter example, while being syntactically correct, gives us wrong result, because it assigns the length of series `B` to all values in the column, and not the length of individual elements as we intended. + +If we need to compute complex expressions like this, we can use `apply` function. The last example can be written as follows: +```python +df['LenB'] = df['B'].apply(lambda x : len(x)) +# or +df['LenB'] = df['B'].apply(len) +``` + +After operations above, we will end up with the following DataFrame: + +| | A | B | DivA | LenB | +| --- | --- | ------ | ---- | ---- | +| 0 | 1 | I | -4.0 | 1 | +| 1 | 2 | like | -3.0 | 4 | +| 2 | 3 | to | -2.0 | 2 | +| 3 | 4 | use | -1.0 | 3 | +| 4 | 5 | Python | 0.0 | 6 | +| 5 | 6 | and | 1.0 | 3 | +| 6 | 7 | Pandas | 2.0 | 6 | +| 7 | 8 | very | 3.0 | 4 | +| 8 | 9 | much | 4.0 | 4 | + +**Selecting rows based on numbers** can be done using `iloc` construct. For example, to select first 5 rows from the DataFrame: +```python +df.iloc[:5] +``` + +**Grouping** is often used to get a result similar to *pivot tables* in Excel. Suppose that we want to compute mean value of column `A` for each given number of `LenB`. Then we can group our DataFrame by `LenB`, and call `mean`: +```python +df.groupby(by='LenB').mean() +``` +If we need to compute mean and the number of elements in the group, then we can use more complex `aggregate` function: +```python +df.groupby(by='LenB') \ + .aggregate({ 'DivA' : len, 'A' : lambda x: x.mean() }) \ + .rename(columns={ 'DivA' : 'Count', 'A' : 'Mean'}) +``` +This gives us the following table: + +| LenB | Count | Mean | +| ---- | ----- | -------- | +| 1 | 1 | 1.000000 | +| 2 | 1 | 3.000000 | +| 3 | 2 | 5.000000 | +| 4 | 3 | 6.333333 | +| 6 | 2 | 6.000000 | + +### Getting Data + +We have seen how easy it is to construct Series and DataFrames from Python objects. However, data usually comes in the form of a text file, or an Excel table. Luckily, Pandas offers us a simple way to load data from disk. For example, reading CSV file is as simple as this: +```python +df = pd.read_csv('file.csv') +``` +We will see more examples of loading data, including fetching it from external web sites, in the "Challenge" section + + +### Printing and Plotting + +A Data Scientist often has to explore the data, thus it is important to be able to visualize it. When DataFrame is big, many times we want just to make sure we are doing everything correctly by printing out the first few rows. This can be done by calling `df.head()`. If you are running it from Jupyter Notebook, it will print out the DataFrame in a nice tabular form. + +We have also seen the usage of `plot` function to visualize some columns. While `plot` is very useful for many tasks, and supports many different graph types via `kind=` parameter, you can always use raw `matplotlib` library to plot something more complex. We will cover data visualization in detail in separate course lessons. + +This overview covers most important concepts of Pandas, however, the library is very rich, and there is no limit to what you can do with it! Let's now apply this knowledge for solving specific problem. + +## 🚀 Challenge 1: Analyzing COVID Spread + +First problem we will focus on is modelling of epidemic spread of COVID-19. In order to do that, we will use the data on the number of infected individuals in different countries, provided by the [Center for Systems Science and Engineering](https://systems.jhu.edu/) (CSSE) at [Johns Hopkins University](https://jhu.edu/). Dataset is available in [this GitHub Repository](https://github.com/CSSEGISandData/COVID-19). + +Since we want to demonstrate how to deal with data, we invite you to open [`notebook-covidspread.ipynb`](notebook-covidspread.ipynb) and read it from top to bottom. You can also execute cells, and do some challenges that we have left for you at the end. + +![COVID Spread](images/covidspread.png) + +> If you do not know how to run code in Jupyter Notebook, have a look at [this article](https://soshnikov.com/education/how-to-execute-notebooks-from-github/). + +## Working with Unstructured Data + +While data very often comes in tabular form, in some cases we need to deal with less structured data, for example, text or images. In this case, to apply data processing techniques we have seen above, we need to somehow **extract** structured data. Here are a few examples: + +* Extracting keywords from text, and seeing how often those keywords appear +* Using neural networks to extract information about objects on the picture +* Getting information on emotions of people on video camera feed + +## 🚀 Challenge 2: Analyzing COVID Papers + +In this challenge, we will continue with the topic of COVID pandemic, and focus on processing scientific papers on the subject. There is [CORD-19 Dataset](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge) with more than 7000 (at the time of writing) papers on COVID, available with metadata and abstracts (and for about half of them there is also full text provided). + +A full example of analyzing this dataset using [Text Analytics for Health](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health/?WT.mc_id=academic-31812-dmitryso) cognitive service is described [in this blog post](https://soshnikov.com/science/analyzing-medical-papers-with-azure-and-text-analytics-for-health/). We will discuss simplified version of this analysis. + +> **NOTE**: We do not provide a copy of the dataset as part of this repository. You may first need to download the [`metadata.csv`](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge?select=metadata.csv) file from [this dataset on Kaggle](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge). Registration with Kaggle may be required. You may also download the dataset without registration [from here](https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases.html), but it will include all full texts in addition to metadata file. + +Open [`notebook-papers.ipynb`](notebook-papers.ipynb) and read it from top to bottom. You can also execute cells, and do some challenges that we have left for you at the end. + +![Covid Medical Treatment](images/covidtreat.png) + +## Processing Image Data + +Recently, very powerful AI models have been developed that allow us to understand images. There are many tasks that can be solved using pre-trained neural networks, or cloud services. Some examples include: + +* **Image Classification**, which can help you categorize the image into one of the pre-defined classes. You can easily train your own image classifiers using services such as [Custom Vision](https://azure.microsoft.com/services/cognitive-services/custom-vision-service/?WT.mc_id=academic-31812-dmitryso) +* **Object Detection** to detect different objects in the image. Services such as [computer vision](https://azure.microsoft.com/services/cognitive-services/computer-vision/?WT.mc_id=academic-31812-dmitryso) can detect a number of common objects, and you can train [Custom Vision](https://azure.microsoft.com/services/cognitive-services/custom-vision-service/?WT.mc_id=academic-31812-dmitryso) model to detect some specific objects of interest. +* **Face Detection**, including Age, Gender and Emotion detection. This can be done via [Face API](https://azure.microsoft.com/services/cognitive-services/face/?WT.mc_id=academic-31812-dmitryso). + +All those cloud services can be called using [Python SDKs](https://docs.microsoft.com/samples/azure-samples/cognitive-services-python-sdk-samples/cognitive-services-python-sdk-samples/?WT.mc_id=academic-31812-dmitryso), and thus can be easily incorporated into your data exploration workflow. + +Here are some examples of exploring data from Image data sources: +* In the blog post [How to Learn Data Science without Coding](https://soshnikov.com/azure/how-to-learn-data-science-without-coding/) we explore Instagram photos, trying to understand what makes people give more likes to a photo. We first extract as much information from pictures as possible using [computer vision](https://azure.microsoft.com/services/cognitive-services/computer-vision/?WT.mc_id=academic-31812-dmitryso), and then use [Azure Machine Learning AutoML](https://docs.microsoft.com/azure/machine-learning/concept-automated-ml/?WT.mc_id=academic-31812-dmitryso) to build interpretable model. +* In [Facial Studies Workshop](https://github.com/CloudAdvocacy/FaceStudies) we use [Face API](https://azure.microsoft.com/services/cognitive-services/face/?WT.mc_id=academic-31812-dmitryso) to extract emotions on people on photographs from events, in order to try to understand what makes people happy. + +## Conclusion + +Whether you already have structured or unstructured data, using Python you can perform all steps related to data processing and understanding. It is probably the most flexible way of data processing, and that is the reason the majority of data scientists use Python as their primary tool. Learning Python in depth is probably a good idea if you are serious about your data science journey! + + + +## [Post-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/13) + +## Review & Self Study + +**Books** +* [Wes McKinney. Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython](https://www.amazon.com/gp/product/1491957662) + +**Online Resources** +* Official [10 minutes to Pandas](https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html) tutorial +* [Documentation on Pandas Visualization](https://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html) + +**Learning Python** +* [Learn Python in a Fun Way with Turtle Graphics and Fractals](https://github.com/shwars/pycourse) +* [Take your First Steps with Python](https://docs.microsoft.com/learn/paths/python-first-steps/?WT.mc_id=academic-31812-dmitryso) Learning Path on [Microsoft Learn](http://learn.microsoft.com/?WT.mc_id=academic-31812-dmitryso) + +## Assignment + +[Perform more detailed data study for the challenges above](assignment.md) + +## Credits + +This lesson has been authored with ♥️ by [Dmitry Soshnikov](http://soshnikov.com) From 48070bfa63b71ac249d579877f829895a8b258e0 Mon Sep 17 00:00:00 2001 From: poo Date: Wed, 8 Dec 2021 18:11:46 +0900 Subject: [PATCH 09/13] ko:07-python README(2) Signed-off-by: poo --- .../07-python/translations/README.ko.md | 186 +++++++++--------- 1 file changed, 94 insertions(+), 92 deletions(-) diff --git a/2-Working-With-Data/07-python/translations/README.ko.md b/2-Working-With-Data/07-python/translations/README.ko.md index 10f74015..7e2aa975 100644 --- a/2-Working-With-Data/07-python/translations/README.ko.md +++ b/2-Working-With-Data/07-python/translations/README.ko.md @@ -26,37 +26,37 @@ -## [Pre-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/12) +## [강의 전 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/12) -## Tabular Data and Dataframes +## 표 형식 데이터 및 데이터 프레임 -You have already met tabular data when we talked about relational databases. When you have a lot of data, and it is contained in many different linked tables, it definitely makes sense to use SQL for working with it. However, there are many cases when we have a table of data, and we need to gain some **understanding** or **insights** about this data, such as the distribution, correlation between values, etc. In data science, there are a lot of cases when we need to perform some transformations of the original data, followed by visualization. Both those steps can be easily done using Python. +이전에 관계형 데이터베이스에 대해 이야기할 때 이미 표 형식의 데이터를 다뤘습니다. 데이터가 많고 다양한 테이블이 연결된 경우 SQL을 사용하여 작업하는 것이 좋습니다. 그러나, 데이터 테이블을 가질 때 많은 경우들이 있으며, 우리는 분포, 값들 사이의 상관관계 등과 같이 데이터 자체에 대한 조금의 **이해**나 **통찰력**을 얻을 필요가 있습니다. 데이터 과학에서는 원본 데이터의 일부 변환을 수행한 후 시각화를 수행해야 하는 경우가 많습니다. 이 두 단계는 파이썬을 사용하면 쉽게 수행할 수 있습니다. -There are two most useful libraries in Python that can help you deal with tabular data: -* **[Pandas](https://pandas.pydata.org/)** allows you to manipulate so-called **Dataframes**, which are analogous to relational tables. You can have named columns, and perform different operations on row, columns and dataframes in general. -* **[Numpy](https://numpy.org/)** is a library for working with **tensors**, i.e. multi-dimensional **arrays**. Array has values of the same underlying type, and it is simpler than dataframe, but it offers more mathematical operations, and creates less overhead. +파이썬에는 표 형식의 데이터를 처리하는 데 도움이 되는 두 가지 가장 유용한 라이브러리가 있습니다: +* **[Pandas](https://pandas.pydata.org/)** 를 사용하면 관계형 테이블과 유사한 이른바 **데이터 프레임**을 조작할 수 있습니다. 명명된 컬럼을 가질 수 있으며 일반적으로 행,열 및 데이터 프레임에 대해 다양한 작업을 수행할 수 있습니다. +* **[Numpy](https://numpy.org/)** 는 **tensors(텐서)** 작업을 위한 라이브러리 입니다. (예: 다차원 **배열**). 배열은 동일한 기본 유형의 값을 가지며 데이터 프레임보다 간단하지만, 더 많은 수학적 연산을 제공하고 오버헤드를 덜 발생시킵니다. -There are also a couple of other libraries you should know about: -* **[Matplotlib](https://matplotlib.org/)** is a library used for data visualization and plotting graphs -* **[SciPy](https://www.scipy.org/)** is a library with some additional scientific functions. We have already come across this library when talking about probability and statistics +또한 알아야 할 몇 개의 또 다른 라이브러리들도 있습니다: +* **[Matplotlib](https://matplotlib.org/)** 은 데이터 시각화 및 플롯 그래프에 사용되는 라이브러리입니다. +* **[SciPy](https://www.scipy.org/)** 는 몇 가지 추가적인 과학적 기능을 가진 라이브러리이다. 우리는 확률과 통계에 대해 이야기할 때 이 라이브러리를 사용합니다. -Here is a piece of code that you would typically use to import those libraries in the beginning of your Python program: +다음은 파이썬 프로그램 시작 부분에서 이러한 라이브러리를 가져오기 위해 일반적으로 사용하는 코드 일부입니다: ```python import numpy as np import pandas as pd import matplotlib.pyplot as plt -from scipy import ... # you need to specify exact sub-packages that you need +from scipy import ... # 필요한 하위 항목을 정확하게 지정해야 합니다. ``` -Pandas is centered around a few basic concepts. +Pandas는 몇 가지 기본적인 개념을 중심으로 합니다. -### Series +### 시리즈(Series) -**Series** is a sequence of values, similar to a list or numpy array. The main difference is that series also has an **index**, and when we operate on series (eg., add them), the index is taken into account. Index can be as simple as integer row number (it is the index used by default when creating a series from list or array), or it can have a complex structure, such as date interval. +**시리즈(Series)** 은 리스트 또는 numpy 배열과 유사한 일련의 값들입니다. 주요 차이점은 시리즈에도 **색인**이 있고 시리즈에 대해 작업할 때(예: 추가) 인덱스가 고려된다는 것입니다. 인덱스는 정수 행 번호만큼 단순할 수도 있고(목록 또는 배열에서 시리즈를 생성할 때 기본적으로 사용되는 인덱스) 날짜 간격과 같은 복잡한 구조를 가질 수도 있습니다. -> **Note**: There is some introductory Pandas code in the accompanying notebook [`notebook.ipynb`](notebook.ipynb). We only outline some the examples here, and you are definitely welcome to check out the full notebook. +> **주의**: 동봉된 [`notebook.ipynb`](notebook.ipynb) 파일에는 몇 가지 Pandas 소개 코드가 있습니다. 여기서는 몇 가지 예시만 간략히 설명하며, 전체 notebook 코드를 확인해 보시기 바랍니다. -Consider an example: we want to analyze sales of our ice-cream spot. Let's generate a series of sales numbers (number of items sold each day) for some time period: +예시: 우리는 아이스크림 가게의 매출을 분석하려고 합니다. 일정 기간 동안 일련의 판매 번호(매일 판매되는 품목 수)를 생성해 봅시다. ```python start_date = "Jan 1, 2020" @@ -66,47 +66,47 @@ print(f"Length of index is {len(idx)}") items_sold = pd.Series(np.random.randint(25,50,size=len(idx)),index=idx) items_sold.plot() ``` -![Time Series Plot](images/timeseries-1.png) +![Time Series Plot](../images/timeseries-1.png) -Now suppose that each week we are organizing a party for friends, and we take additional 10 packs of ice-cream for a party. We can create another series, indexed by week, to demonstrate that: +이제 우리가 매주 친구들을 위한 파티를 준비하고, 파티를 위해 아이스크림 10팩을 추가로 가져간다고 가정해 봅시다. 이것을 증명하기 위해 주간별로 색인화된 또 다른 시리즈를 만들 수 있습니다: ```python additional_items = pd.Series(10,index=pd.date_range(start_date,end_date,freq="W")) ``` -When we add two series together, we get total number: +두 시리즈를 더하면 총 갯수(total_items)가 나온다: ```python total_items = items_sold.add(additional_items,fill_value=0) total_items.plot() ``` -![Time Series Plot](images/timeseries-2.png) +![Time Series Plot](../images/timeseries-2.png) -> **Note** that we are not using simple syntax `total_items+additional_items`. If we did, we would have received a lot of `NaN` (*Not a Number*) values in the resulting series. This is because there are missing values for some of the index point in the `additional_items` series, and adding `Nan` to anything results in `NaN`. Thus we need to specify `fill_value` parameter during addition. +> **주의** 지금까지 우리는 `total_control+control_control_control` 이라는 간단한 구문을 사용하지 않고 있습니다. 그랬다면 결과 시리즈에서 많은 `NaN` (*숫자가 아님*) 값을 받았을 것입니다. 이는 `additional_items` 시리즈의 일부 인덱스 포인트에 누락된 값이 있고 항목에 `Nan`을 추가하면 `NaN`이 되기 때문입니다. 따라서 추가하는 동안 'fill_value' 매개변수를 지정해야 합니다. -With time series, we can also **resample** the series with different time intervals. For example, suppose we want to compute mean sales volume monthly. We can use the following code: +시계열을 사용하면 다른 시간 간격으로 시리즈를 **리샘플링(resample)**할 수도 있습니다. 예를 들어, 월별 평균 판매량을 계산하려고 한다고 가정합니다. 다음 코드를 사용할 수 있습니다: ```python monthly = total_items.resample("1M").mean() ax = monthly.plot(kind='bar') ``` -![Monthly Time Series Averages](images/timeseries-3.png) +![Monthly Time Series Averages](../images/timeseries-3.png) -### DataFrame +### 데이터프레임 -A DataFrame is essentially a collection of series with the same index. We can combine several series together into a DataFrame: +데이터프레임은 기본적으로 동일한 인덱스를 가진 시리즈 모음입니다. 여러 시리즈를 데이터프레임으로 결합할 수 있습니다: ```python a = pd.Series(range(1,10)) b = pd.Series(["I","like","to","play","games","and","will","not","change"],index=range(0,9)) df = pd.DataFrame([a,b]) ``` -This will create a horizontal table like this: +이렇게 하면 다음과 같은 가로 테이블이 생성됩니다: | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | | --- | --- | ---- | --- | --- | ------ | --- | ------ | ---- | ---- | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | | 1 | I | like | to | use | Python | and | Pandas | very | much | -We can also use Series as columns, and specify column names using dictionary: +시리즈를 열로 사용하고 딕셔너리(Dictionary)를 사용하여 열 이름을 지정할 수도 있습니다: ```python df = pd.DataFrame({ 'A' : a, 'B' : b }) ``` -This will give us a table like this: +위의 코드는 다음과 같은 테이블을 얻을 수 있습니다: | | A | B | | --- | --- | ------ | @@ -120,39 +120,39 @@ This will give us a table like this: | 7 | 8 | very | | 8 | 9 | much | -**Note** that we can also get this table layout by transposing the previous table, eg. by writing +**주의** 또한 이전 표를 바꿔서 이 같은 표 레이아웃을 얻을 수 있습니다. ```python df = pd.DataFrame([a,b]).T..rename(columns={ 0 : 'A', 1 : 'B' }) ``` -Here `.T` means the operation of transposing the DataFrame, i.e. changing rows and columns, and `rename` operation allows us to rename columns to match the previous example. +여기서 `.T`는 행과 열을 변경하는 DataFrame을 전치하는 작업, 즉 행과 열을 변경하는 작업을 의미하며 `rename` 작업을 사용하면 이전 예제와 일치하도록 열 이름을 바꿀 수 있습니다. -Here are a few most important operations we can perform on DataFrames: +다음은 데이터프레임에서 수행할 수 있는 몇 가지 가장 중요한 작업입니다: -**Column selection**. We can select individual columns by writing `df['A']` - this operation returns a Series. We can also select a subset of columns into another DataFrame by writing `df[['B','A']]` - this return another DataFrame. +**특정 컬럼 선택(Column selection)**. `df['A']`를 작성하여 개별 열을 선택할 수 있습니다. 이 작업은 시리즈를 반환합니다. 또한 `df[['B','A']]`를 작성하여 열의 하위 집합을 다른 데이터프레임으로 선택할 수 있습니다. 그러면 다른 데이터프레임이 반환됩니다. -**Filtering** only certain rows by criteria. For example, to leave only rows with column `A` greater than 5, we can write `df[df['A']>5]`. +**필터링(Filtering)** 은 기준에 따라 특정 행만 적용합니다. 예를 들어 `A` 열이 5보다 큰 행만 남기려면 `df[df['A']>5]`라고 쓸 수 있습니다. -> **Note**: The way filtering works is the following. The expression `df['A']<5` returns a boolean series, which indicates whether expression is `True` or `False` for each element of the original series `df['A']`. When boolean series is used as an index, it returns subset of rows in the DataFrame. Thus it is not possible to use arbitrary Python boolean expression, for example, writing `df[df['A']>5 and df['A']<7]` would be wrong. Instead, you should use special `&` operation on boolean series, writing `df[(df['A']>5) & (df['A']<7)]` (*brackets are important here*). +> **주의**: 필터링이 작동하는 방식은 다음과 같습니다. 표현식 `df['A']<5`는 원래 시리즈 `df['A']`의 각 요소에 대해 표현식이 `True`인지 아니면 `False`인지를 나타내는 `부울(Boolean)` 시리즈를 반환합니다. 부울 계열이 인덱스로 사용되면 데이터프레임에서 행의 하위 집합을 반환합니다. 따라서 임의의 Python 부울 표현식을 사용할 수 없습니다. 예를 들어 `df[df['A']>5 및 df['A']<7]`를 작성하는 것은 잘못된 것입니다. 대신, 부울 계열에 특수 `&` 연산을 사용하여 `df[(df['A']>5) & (df['A']<7)]`로 작성해야 합니다(*여기서 대괄호가 중요합니다*). -**Creating new computable columns**. We can easily create new computable columns for our DataFrame by using intuitive expression like this: +**새로운 계산 가능한 열 만들기**. 우리는 직관적인 표현을 사용하여 데이터프레임에 대한 새로운 계산 가능한 열을 쉽게 만들 수 있습니다.: ```python df['DivA'] = df['A']-df['A'].mean() ``` -This example calculates divergence of A from its mean value. What actually happens here is we are computing a series, and then assigning this series to the left-hand-side, creating another column. Thus, we cannot use any operations that are not compatible with series, for example, the code below is wrong: +이 예제에서는 평균값으로부터 A의 차이를 계산합니다. 여기서 실제로 발생하는 일은 열을 계산하고 왼쪽에 이 열을 할당하여 다른 열을 만드는 것입니다. 따라서 시리즈와 호환되지 않는 연산은 사용할 수 없습니다. 예를 들어 아래와 같은 코드는 잘못되었습니다.: ```python -# Wrong code -> df['ADescr'] = "Low" if df['A'] < 5 else "Hi" -df['LenB'] = len(df['B']) # <- Wrong result +# 잘못된 코드 -> df['ADescr'] = "Low" if df['A'] < 5 else "Hi" +df['LenB'] = len(df['B']) # <- 잘못된 결과 ``` -The latter example, while being syntactically correct, gives us wrong result, because it assigns the length of series `B` to all values in the column, and not the length of individual elements as we intended. +위의 예제는 문법적으로는 정확하지만, 우리가 의도한 대로 개별 요소의 길이가 아니라 열의 모든 값에 시리즈 `B`의 길이를 할당하기 때문에 잘못된 결과를 도출합니다. -If we need to compute complex expressions like this, we can use `apply` function. The last example can be written as follows: +이와 같이 복잡한 표현식을 계산해야 하는 경우 `apply` 함수를 사용할 수 있습니다. 마지막 예제는 다음과 같이 작성할 수 있습니다: ```python df['LenB'] = df['B'].apply(lambda x : len(x)) # or df['LenB'] = df['B'].apply(len) ``` -After operations above, we will end up with the following DataFrame: +위의 작업 후에 다음과 같은 데이터프레임이 완성됩니다: | | A | B | DivA | LenB | | --- | --- | ------ | ---- | ---- | @@ -166,16 +166,16 @@ After operations above, we will end up with the following DataFrame: | 7 | 8 | very | 3.0 | 4 | | 8 | 9 | much | 4.0 | 4 | -**Selecting rows based on numbers** can be done using `iloc` construct. For example, to select first 5 rows from the DataFrame: +**숫자를 기준으로 행 선택** `iloc(정수 위치:integer location)` 구성을 사용하여 수행할 수 있습니다. 예를 들어 데이터프레임에서 처음 5개 행을 선택하려면: ```python df.iloc[:5] ``` -**Grouping** is often used to get a result similar to *pivot tables* in Excel. Suppose that we want to compute mean value of column `A` for each given number of `LenB`. Then we can group our DataFrame by `LenB`, and call `mean`: +**그룹화(Grouping)** 는 종종 Excel의 *피벗 테이블*과 유사한 결과를 얻는 데 사용됩니다. 주어진 `LenB` 수에 대해 `A` 열의 평균 값을 계산하려고 한다고 가정합니다. 그런 다음 `LenB`로 데이터프레임을 그룹화하고 `mean`을 호출할 수 있습니다: ```python df.groupby(by='LenB').mean() ``` -If we need to compute mean and the number of elements in the group, then we can use more complex `aggregate` function: +그룹의 요소 수와 평균을 계산해야 하는 경우 더 복잡한 `집계(aggregate)` 함수를 사용할 수 있습니다: ```python df.groupby(by='LenB') \ .aggregate({ 'DivA' : len, 'A' : lambda x: x.mean() }) \ @@ -191,92 +191,94 @@ This gives us the following table: | 4 | 3 | 6.333333 | | 6 | 2 | 6.000000 | -### Getting Data +### 데이터 얻기 -We have seen how easy it is to construct Series and DataFrames from Python objects. However, data usually comes in the form of a text file, or an Excel table. Luckily, Pandas offers us a simple way to load data from disk. For example, reading CSV file is as simple as this: +우리는 Python 객체에서 시리즈 및 데이터프레임을 구성하는 것이 얼마나 쉬운지 보았습니다. 그러나 데이터는 일반적으로 텍스트 파일 또는 Excel 표의 형태로 제공됩니다. 운 좋게도 Pandas는 디스크에서 데이터를 로드하는 간단한 방법을 제공합니다. 예를 들어 CSV 파일을 읽는 것은 다음과 같이 간단합니다: ```python df = pd.read_csv('file.csv') ``` -We will see more examples of loading data, including fetching it from external web sites, in the "Challenge" section +"도전(Channenge)" 섹션에서 외부 웹 사이트에서 가져오기를 포함하여 데이터를 로드하는 더 많은 예를 볼 수 있습니다. -### Printing and Plotting +### 출력(Printing) 및 플로팅(Plotting) -A Data Scientist often has to explore the data, thus it is important to be able to visualize it. When DataFrame is big, many times we want just to make sure we are doing everything correctly by printing out the first few rows. This can be done by calling `df.head()`. If you are running it from Jupyter Notebook, it will print out the DataFrame in a nice tabular form. +데이터 과학자는 종종 데이터를 탐색해야 하므로 시각화할 수 있는 것이 중요합니다. 데이터프레임이 클 때 처음 몇 행을 인쇄하여 모든 작업을 올바르게 수행하고 있는지 확인하려는 경우가 많습니다. 이것은 `df.head()`를 호출하여 수행할 수 있습니다. Jupyter Notebook에서 실행하는 경우 데이터프레임을 멋진 표 형식으로 인쇄합니다. -We have also seen the usage of `plot` function to visualize some columns. While `plot` is very useful for many tasks, and supports many different graph types via `kind=` parameter, you can always use raw `matplotlib` library to plot something more complex. We will cover data visualization in detail in separate course lessons. +또한 일부 열을 시각화하기 위해 'plot' 함수를 사용하는 것을 보았습니다. `plot`은 많은 작업에 매우 유용하고 `kind=` 매개변수를 통해 다양한 그래프 유형을 지원하지만, 항상 원시 `matplotlib` 라이브러리를 사용하여 더 복잡한 것을 그릴 수 있습니다. 데이터 시각화는 별도의 강의에서 자세히 다룰 것입니다. -This overview covers most important concepts of Pandas, however, the library is very rich, and there is no limit to what you can do with it! Let's now apply this knowledge for solving specific problem. +이 개요는 Pandas의 가장 중요한 개념을 다루지만 Pandas 라이브러리는 매우 풍부하고 이를 사용하여 수행할 수 있는 작업은 무궁무진합니다! 이제 특정 문제를 해결하기 위해 배운 것을 적용해 보겠습니다. -## 🚀 Challenge 1: Analyzing COVID Spread +## 🚀 도전과제 1: 코로나 확산 분석 -First problem we will focus on is modelling of epidemic spread of COVID-19. In order to do that, we will use the data on the number of infected individuals in different countries, provided by the [Center for Systems Science and Engineering](https://systems.jhu.edu/) (CSSE) at [Johns Hopkins University](https://jhu.edu/). Dataset is available in [this GitHub Repository](https://github.com/CSSEGISandData/COVID-19). +우리가 초점을 맞출 첫 번째 문제는 COVID-19의 전염병 확산 모델링입니다. 이를 위해 [존 홉킨스 대학](https://jhu.edu/)의 [시스템 과학 및 엔지니어링 센터](https://systems.jhu.edu/)(CSSE)에서 제공하는 여러 국가의 감염자 수 데이터를 사용합니다. 이 [GitHub 레포지토리](https://github.com/CSSEGISandData/COVID-19)에서 데이터 세트를 사용할 수 있습니다. -Since we want to demonstrate how to deal with data, we invite you to open [`notebook-covidspread.ipynb`](notebook-covidspread.ipynb) and read it from top to bottom. You can also execute cells, and do some challenges that we have left for you at the end. +데이터를 다루는 방법을 보여주고 싶기 때문에 `notebook-covidspread.ipynb`(notebook-covidspread.ipynb)를 열고 위에서 아래로 읽으시기 바랍니다. 셀을 실행할 수도 있고 마지막에 남겨둔 몇 가지 과제를 수행할 수도 있습니다. -![COVID Spread](images/covidspread.png) +![COVID Spread](../images/covidspread.png) -> If you do not know how to run code in Jupyter Notebook, have a look at [this article](https://soshnikov.com/education/how-to-execute-notebooks-from-github/). +> Jupyter Notebook에서 코드를 실행하는 방법을 모르는 경우 [이 기사](https://soshnikov.com/education/how-to-execute-notebooks-from-github/)를 참조하십시오. -## Working with Unstructured Data +## 비정형 데이터 작업 -While data very often comes in tabular form, in some cases we need to deal with less structured data, for example, text or images. In this case, to apply data processing techniques we have seen above, we need to somehow **extract** structured data. Here are a few examples: +데이터가 표 형식으로 제공되는 경우가 많지만 경우에 따라 텍스트나 이미지와 같이 덜 구조화된 데이터를 처리해야 합니다. 이 경우 위에서 본 데이터 처리 기술을 적용하려면 어떻게든 구조화된 데이터를 **추출(extract)** 해야 합니다. 다음은 몇 가지 예시입니다: -* Extracting keywords from text, and seeing how often those keywords appear -* Using neural networks to extract information about objects on the picture -* Getting information on emotions of people on video camera feed +* 텍스트에서 키워드 추출 및 해당 키워드가 나타나는 빈도 확인 +* 신경망을 사용하여 그림의 개체에 대한 정보 추출 +* 비디오 카메라 피드에서 사람들의 감정에 대한 정보 얻기 -## 🚀 Challenge 2: Analyzing COVID Papers +## 🚀 도전과제 2: 코로나 논문 분석 -In this challenge, we will continue with the topic of COVID pandemic, and focus on processing scientific papers on the subject. There is [CORD-19 Dataset](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge) with more than 7000 (at the time of writing) papers on COVID, available with metadata and abstracts (and for about half of them there is also full text provided). +이 도전과제에서 우리는 COVID 팬데믹이라는 주제를 계속해서 다룰 것이며 해당 주제에 대한 과학 논문을 처리하는 데 집중할 것입니다. 메타데이터 및 초록과 함께 사용할 수 있는 COVID에 대한 7000개 이상의(작성 당시) 논문이 포함된 [CORD-19 데이터 세트](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge)가 있습니다(이 중 약 절반에 대해 전체 텍스트도 제공됨). -A full example of analyzing this dataset using [Text Analytics for Health](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health/?WT.mc_id=academic-31812-dmitryso) cognitive service is described [in this blog post](https://soshnikov.com/science/analyzing-medical-papers-with-azure-and-text-analytics-for-health/). We will discuss simplified version of this analysis. +[건강 인지 서비스를 위한 텍스트 분석](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health/?WT.mc_id=academic-31812-dmitryso)를 사용하여 이 데이터 세트를 분석하는 전체 예는 이 블로그 게시물에 설명되어 있습니다. 우리는 이 분석의 단순화된 버전에 대해 논의할 것입니다. -> **NOTE**: We do not provide a copy of the dataset as part of this repository. You may first need to download the [`metadata.csv`](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge?select=metadata.csv) file from [this dataset on Kaggle](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge). Registration with Kaggle may be required. You may also download the dataset without registration [from here](https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases.html), but it will include all full texts in addition to metadata file. +> **주의**: 우리는 더이상 데이터 세트의 복사본을 이 리포지토리의 일부로 제공하지 않습니다. 먼저 [Kaggle의 데이터세트](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge)에서 [`metadata.csv`](https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge?select=metadata.csv) 파일을 다운로드해야 할 수도 있습니다. Kaggle에 가입해야 할 수 있습니다. [여기](https://ai2-semanticscholar-cord-19.s3-us-west-2.amazonaws.com/historical_releases.html)에서 등록 없이 데이터 세트를 다운로드할 수도 있지만 여기에는 메타데이터 파일 외에 모든 전체 텍스트가 포함됩니다. -Open [`notebook-papers.ipynb`](notebook-papers.ipynb) and read it from top to bottom. You can also execute cells, and do some challenges that we have left for you at the end. +[`notebook-papers.ipynb`](notebook-papers.ipynb)를 열고 위에서 아래로 읽으십시오. 셀을 실행할 수도 있고 마지막에 남겨둔 몇 가지 과제를 수행할 수도 있습니다. -![Covid Medical Treatment](images/covidtreat.png) +![Covid Medical Treatment](../images/covidtreat.png) -## Processing Image Data +## 이미지 데이터 처리 -Recently, very powerful AI models have been developed that allow us to understand images. There are many tasks that can be solved using pre-trained neural networks, or cloud services. Some examples include: +최근에는 이미지를 이해할 수 있는 매우 강력한 AI 모델이 개발되었습니다. 사전에 훈련된 신경망이나 클라우드 서비스를 사용하여 해결할 수 있는 작업이 많이 있습니다. 몇 가지 예는 다음과 같습니다: -* **Image Classification**, which can help you categorize the image into one of the pre-defined classes. You can easily train your own image classifiers using services such as [Custom Vision](https://azure.microsoft.com/services/cognitive-services/custom-vision-service/?WT.mc_id=academic-31812-dmitryso) -* **Object Detection** to detect different objects in the image. Services such as [computer vision](https://azure.microsoft.com/services/cognitive-services/computer-vision/?WT.mc_id=academic-31812-dmitryso) can detect a number of common objects, and you can train [Custom Vision](https://azure.microsoft.com/services/cognitive-services/custom-vision-service/?WT.mc_id=academic-31812-dmitryso) model to detect some specific objects of interest. -* **Face Detection**, including Age, Gender and Emotion detection. This can be done via [Face API](https://azure.microsoft.com/services/cognitive-services/face/?WT.mc_id=academic-31812-dmitryso). +* **이미지 분류(Image Classification)** 는 이미지를 미리 정의된 클래스 중 하나로 분류하는 데 도움이 됩니다. [Custom Vision](https://azure.microsoft.com/services/cognitive-services/custom-vision-service/?WT.mc_id=academic-31812-dmitryso)과 같은 서비스를 사용하여 자신의 이미지 분류기를 쉽게 훈련할 수 있습니다. +* **물체 검출** 은 이미지에서 다른 물체를 감지합니다. [컴퓨터 비전(Computer vision)](https://azure.microsoft.com/services/cognitive-services/computer-vision/?WT.mc_id=academic-31812-dmitryso)과 같은 서비스는 여러 일반 개체를 감지할 수 있으며 [커스텀 비전(Custom Vision)](https://azure.microsoft.com/services/cognitive-services/custom-vision-service/?WT.mc_id=academic-31812-dmitryso) 모델을 훈련하여 관심 있는 특정 개체를 감지할 수 있습니다. +* **얼굴 인식** 은 연령, 성별 및 감정 감지를 포함합니다. 이것은 [Face API](https://azure.microsoft.com/services/cognitive-services/face/?WT.mc_id=academic-31812-dmitryso)를 통해 수행할 수 있습니다. -All those cloud services can be called using [Python SDKs](https://docs.microsoft.com/samples/azure-samples/cognitive-services-python-sdk-samples/cognitive-services-python-sdk-samples/?WT.mc_id=academic-31812-dmitryso), and thus can be easily incorporated into your data exploration workflow. +이러한 모든 클라우드 서비스는 [Python SDK](https://docs.microsoft.com/samples/azure-samples/cognitive-services-python-sdk-samples/cognitive-services-python-sdk-samples/?WT.mc_id=academic-31812-dmitryso)를 사용하여 호출할 수 있으므로, 데이터 탐색 워크플로에 쉽게 통합할 수 있습니다. + +다음은 이미지 데이터 소스에서 데이터를 탐색하는 몇 가지 예입니다: +* 블로그 게시물 중 [코딩 없이 데이터 과학을 배우는 방법](https://soshnikov.com/azure/how-to-learn-data-science-without-coding/)에서 우리는 인스타그램 사진을 살펴보고 사람들이 사진에 더 많은 좋아요를 주는 이유를 이해하려고 합니다. 먼저 [컴퓨터 비전(Computer vision)](https://azure.microsoft.com/services/cognitive-services/computer-vision/?WT.mc_id=academic-31812-dmitryso)을 사용하여 사진에서 최대한 많은 정보를 추출한 다음 [Azure Machine Learning AutoML](https://docs.microsoft.com/azure/machine-learning/concept-automated-ml/?WT.mc_id=academic-31812-dmitryso)을 사용하여 해석 가능한 모델을 빌드합니다. +* [얼굴 연구 워크숍(Facial Studies Workshop)](https://github.com/CloudAdvocacy/FaceStudies)에서는 사람들을 행복하게 만드는 요소를 이해하고자, 이벤트에서 사진에 있는 사람들의 감정을 추출하기 위해 [Face API](https://azure.microsoft.com/services/cognitive-services/face/?WT.mc_id=academic-31812-dmitryso)를 사용합니다. -Here are some examples of exploring data from Image data sources: -* In the blog post [How to Learn Data Science without Coding](https://soshnikov.com/azure/how-to-learn-data-science-without-coding/) we explore Instagram photos, trying to understand what makes people give more likes to a photo. We first extract as much information from pictures as possible using [computer vision](https://azure.microsoft.com/services/cognitive-services/computer-vision/?WT.mc_id=academic-31812-dmitryso), and then use [Azure Machine Learning AutoML](https://docs.microsoft.com/azure/machine-learning/concept-automated-ml/?WT.mc_id=academic-31812-dmitryso) to build interpretable model. -* In [Facial Studies Workshop](https://github.com/CloudAdvocacy/FaceStudies) we use [Face API](https://azure.microsoft.com/services/cognitive-services/face/?WT.mc_id=academic-31812-dmitryso) to extract emotions on people on photographs from events, in order to try to understand what makes people happy. +## 결론 -## Conclusion +이미 정형 데이터이든 비정형 데이터이든 관계없이 Python을 사용하여 데이터 처리 및 이해와 관련된 모든 단계를 수행할 수 있습니다. 아마도 가장 유연한 데이터 처리 방법일 것이며, 이것이 대부분의 데이터 과학자들이 Python을 기본 도구로 사용하는 이유입니다. 데이터 과학 여정에 대해 진지하게 생각하고 있다면 Python을 깊이 있게 배우는 것이 좋습니다! -Whether you already have structured or unstructured data, using Python you can perform all steps related to data processing and understanding. It is probably the most flexible way of data processing, and that is the reason the majority of data scientists use Python as their primary tool. Learning Python in depth is probably a good idea if you are serious about your data science journey! +## [강의 후 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/13) +## 리뷰 & 복습 -## [Post-lecture quiz](https://red-water-0103e7a0f.azurestaticapps.net/quiz/13) +**책** -## Review & Self Study +* [Wes McKinney. 데이터 분석을 위한 Python: Pandas, NumPy 및 IPython을 사용한 데이터 논쟁(Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython)](https://www.amazon.com/gp/product/1491957662) -**Books** -* [Wes McKinney. Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython](https://www.amazon.com/gp/product/1491957662) +**온라인 자료** -**Online Resources** -* Official [10 minutes to Pandas](https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html) tutorial -* [Documentation on Pandas Visualization](https://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html) +* 공식 [판다까지 10분(10 minutes to Pandas)](https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html) tutorial +* [Pandas 시각화에 대한 문서(Documentation on Pandas Visualization)](https://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html) -**Learning Python** -* [Learn Python in a Fun Way with Turtle Graphics and Fractals](https://github.com/shwars/pycourse) -* [Take your First Steps with Python](https://docs.microsoft.com/learn/paths/python-first-steps/?WT.mc_id=academic-31812-dmitryso) Learning Path on [Microsoft Learn](http://learn.microsoft.com/?WT.mc_id=academic-31812-dmitryso) +**Python 학습** -## Assignment +* [거북이 그래픽과 도형으로 재미있는 방식으로 파이썬 배우기(Learn Python in a Fun Way with Turtle Graphics and Fractals)](https://github.com/shwars/pycourse) +* [파이썬으로 첫걸음(Take your First Steps with Python)](https://docs.microsoft.com/learn/paths/python-first-steps/?WT.mc_id=academic-31812-dmitryso): 관련 강의 [Microsoft 강의](http://learn.microsoft.com/?WT.mc_id=academic-31812-dmitryso) -[Perform more detailed data study for the challenges above](assignment.md) +## 과제 -## Credits +[Perform more detailed data study for the challenges above](../assignment.md) -This lesson has been authored with ♥️ by [Dmitry Soshnikov](http://soshnikov.com) +## 크레딧 + +본 레슨은 [Dmitry Soshnikov](http://soshnikov.com)님에 의해 작성되었습니다. From ade306aba0ef81ec94f9cef43422bdc58eacaccc Mon Sep 17 00:00:00 2001 From: poo Date: Thu, 9 Dec 2021 11:43:26 +0900 Subject: [PATCH 10/13] ko:08-data-preparation README Signed-off-by: poo --- .../translations/README.ko.md | 339 ++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 2-Working-With-Data/08-data-preparation/translations/README.ko.md diff --git a/2-Working-With-Data/08-data-preparation/translations/README.ko.md b/2-Working-With-Data/08-data-preparation/translations/README.ko.md new file mode 100644 index 00000000..9844a6cb --- /dev/null +++ b/2-Working-With-Data/08-data-preparation/translations/README.ko.md @@ -0,0 +1,339 @@ +# 데이터 작업: 데이터 전처리 + +|![ Sketchnote by [(@sketchthedocs)](https://sketchthedocs.dev) ](../../../sketchnotes/08-DataPreparation.png)| +|:---:| +|데이터 전처리 - _Sketchnote by [@nitya](https://twitter.com/nitya)_ | + +## [강의 전 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/14) + + + +원본에 따라 원시 데이터에는 분석 및 모델링에 문제를 일으킬 수 있는 일부 불일치 요소가 포함될 수 있습니다. 즉, 이 데이터는 "더티"로 분류될 수 있으며 사전에 처리해야 합니다. 이 단원에서는 누락, 혹은 부정확하거나 불완전한 데이터의 문제를 처리하기 위해 데이터를 정리하고 변환하는 기술에 중점을 둡니다. 이 강의에서 다루는 주제는 Python과 Pandas 라이브러리를 활용하며 이 디렉토리의 [notebook](notebook.ipynb)에서 시연됩니다. + +## 정제 데이터의 중요성 + +- **사용 및 재사용 용이성**: 데이터가 적절하게 구성되고 정규화되면 검색, 사용 및 다른 사람과 공유하기가 더 쉽습니다. + +- **일관성**: 데이터 과학은 종종 복수의 데이터셋으로 작업해야 하는데, 서로 다른 소스의 데이터셋은 함께 결합되야 합니다. 각 개별 데이터 세트에 공통 표준화가 적용되도록 하나의 데이터 세트로 병합될 때 더욱 유용합니다. + +- **모델 정확도**: 데이터를 정제하면 해당 데이터에 의존하는 모델의 정확도가 향상됩니다. + +## 공통 정제 목표 및 전략 + +- **데이터셋 탐색**: [이후 강의](https://github.com/microsoft/Data-Science-For-Beginners/tree/main/4-Data-Science-Lifecycle/15-analyzing)에서 다룰 데이터 탐색은 정제해야 하는 데이터를 찾는 데 도움이 될 수 있습니다. 데이터셋 내의 값을 시각적으로 관찰하면 나머지 데이터가 어떻게 보일지에 대한 기대치를 설정하거나, 해결할 수 있는 문제에 대한 아이디어를 제공할 수 있습니다. 탐색에는 기본 쿼리, 시각화 및 샘플링이 포함될 수 있습니다. + +- **형식화(Formatting)**: 소스에 따라 데이터가 표시되는 방식에 불일치가 있을 수 있습니다. 이로 인해 데이터셋 내에서 표시되지만 시각화 또는 쿼리 결과에 제대로 표시되지 않는 값을 검색하고 표시하는 데 문제가 발생할 수 있습니다. 일반적인 형식화 문제에는 공백, 날짜 및 데이터 유형 해결이 포함되며 이러한 문제를 해결하는 것은 일반적으로 데이터를 사용하는 사람들에게 달려 있습니다. 예를 들어 날짜와 숫자가 표시되는 방식에 대한 표준은 국가마다 다를 수 있습니다. + +- **중복**: 두 번 이상 발생하는 데이터는 부정확한 결과를 생성할 수 있으므로 보통 제거해야 합니다. 이는 두 개 이상의 데이터셋을 함께 결합할 때 발생할 수 있습니다. 그러나 결합된 데이터셋의 중복이 추가 정보를 제공할 수 있으며 보존할 필요가 있는 경우도 있습니다. + +- **결측치(Missing Data)**: 누락된 데이터는 부정확함과 편향된 결과를 초래할 수 있습니다. 때로는 데이터를 "다시 로드"하여 누락된 값을 Python과 같은 계산 및 코드로 채우거나 단순히 값과 해당 데이터를 제거하여 이러한 문제를 해결할 수 있습니다. 데이터가 누락되는 데는 여러 가지 이유가 있으며 이러한 누락된 값을 해결하기 위한 방법론은 초기 데이터가 누락된 이유에 따라 달라질 수 있습니다. + +## DataFrame 정보 탐색 +> **학습 목표:** 하위 섹션이 끝날때까지, pandas DataFrame에 저장된 데이터에 대한 정보를 능숙하게 찾을 수 있을 것입니다. + +데이터를 pandas에 로드하면 DataFrame에 없을 가능성이 더 높아집니다(이전 [단원](https://github.com/microsoft/Data-Science-For-Beginners/tree/main/2-Working-With-Data/07-python#dataframe) 참조. 그러나 DataFrame에 있는 데이터셋에 60,000개의 행과 400개의 열이 있는 경우). 다행스럽게도 [pandas](https://pandas.pydata.org/)는 처음 몇 행과 마지막 몇 행 외에도 DataFrame에 대한 전체 정보를 빠르게 볼 수 있는 몇 가지 편리한 도구를 제공합니다. + + +이 기능을 살펴보기 위해 Python scikit-learn 라이브러리를 가져오고 상징적인 데이터셋인 **Iris 데이터셋** 을 사용합니다. + +```python +import pandas as pd +from sklearn.datasets import load_iris + +iris = load_iris() +iris_df = pd.DataFrame(data=iris['data'], columns=iris['feature_names']) +``` +| |sepal length (cm)|sepal width (cm)|petal length (cm)|petal width (cm)| +|----------------------------------------|-----------------|----------------|-----------------|----------------| +|0 |5.1 |3.5 |1.4 |0.2 | +|1 |4.9 |3.0 |1.4 |0.2 | +|2 |4.7 |3.2 |1.3 |0.2 | +|3 |4.6 |3.1 |1.5 |0.2 | +|4 |5.0 |3.6 |1.4 |0.2 | + +- **DataFrame.info**: 시작하기 앞서, `info()` 메서드를 사용하여 `DataFrame`에 있는 내용의 요약을 프린트합니다. 이 데이터셋을 살펴보고 우리가 가지고 있는 것이 무엇인지 살펴보겠습니다: + +```python +iris_df.info() +``` +``` +RangeIndex: 150 entries, 0 to 149 +Data columns (total 4 columns): + # Column Non-Null Count Dtype +--- ------ -------------- ----- + 0 sepal length (cm) 150 non-null float64 + 1 sepal width (cm) 150 non-null float64 + 2 petal length (cm) 150 non-null float64 + 3 petal width (cm) 150 non-null float64 +dtypes: float64(4) +memory usage: 4.8 KB +``` +이를 통해 *Iris* 데이터셋에는 null 항목이 없는 4개의 열에 150개의 항목이 있음을 알 수 있습니다. 모든 데이터는 64비트 부동 소수점 숫자로 저장됩니다. + +- **DataFrame.head()**: 다음으로, `DataFrame`의 실제 내용을 확인하기 위해 `head()` 메소드를 사용합니다. `iris_df`의 처음 몇 행이 어떻게 생겼는지 봅시다: +```python +iris_df.head() +``` +``` + sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) +0 5.1 3.5 1.4 0.2 +1 4.9 3.0 1.4 0.2 +2 4.7 3.2 1.3 0.2 +3 4.6 3.1 1.5 0.2 +4 5.0 3.6 1.4 0.2 +``` +- **DataFrame.tail()**: Conversely, to check the last few rows of the `DataFrame`, we use the `tail()` method: +```python +iris_df.tail() +``` +``` + sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) +145 6.7 3.0 5.2 2.3 +146 6.3 2.5 5.0 1.9 +147 6.5 3.0 5.2 2.0 +148 6.2 3.4 5.4 2.3 +149 5.9 3.0 5.1 1.8 +``` +> **추가 팁:** DataFrame의 정보에 대한 메타데이터나 하나의 처음과 마지막 몇 개의 값을 보는 것만으로도 처리 중인 데이터의 크기, 모양 및 내용에 대한 즉각적인 아이디어를 얻을 수 있습니다. + +## 결측치 처리 +> **학습 목표:** 이 하위 섹션이 끝나면 DataFrame에서 null 값을 대체하거나 제거하는 방법을 배울 수 있습니다. + +대부분의 경우 사용하려는(사용해야 하는) 데이터셋은 누락된 값이 있습니다. 누락된 데이터를 처리하는 방법은 최종 분석 및 실제 결과에 영향을 줄 수 있는 미묘한 절충안을 수반합니다. + +Pandas는 두 가지 방법으로 결측치를 처리합니다. 이전 섹션에서 본 첫 번째 항목: `NaN` 또는 숫자 아님. 이것은 실제로 IEEE 부동 소수점 사양의 일부인 특수 값이며 누락된 부동 소수점 값을 나타내는 데만 사용됩니다. + +float를 제외한 누락된 값의 경우 pandas는 Python `None` 객체를 사용합니다. 본질적으로 같은 두 가지 다른 종류의 값을 만나는 것이 혼란스러울 수 있지만, 이는 합리적인 프로그램적 이유가 있으며 실제로 이 같은 로직을 따를시 Pandas가 대부분의 경우 좋은 절충안을 제공할 수 있습니다. 그럼에도 불구하고 `None`과 `NaN` 모두 사용 방법과 관련하여 유의할 필요가 있습니다. + +[Notebook](https://github.com/microsoft/Data-Science-For-Beginners/blob/main/4-Data-Science-Lifecycle/15-analyzing/notebook.ipynb)에서 'NaN' 및 'None'에 대해 자세히 알아보자! + +- **null 값 감지**: `pandas`에서 `isnull()` 및 `notnull()` 메서드는 null 데이터를 감지하는 기본 메서드입니다. 둘 다 데이터에 부울(bool) 마스크를 반환합니다. `NaN` 값을 받기 위해 `numpy`를 사용할 것입니다: +```python +import numpy as np + +example1 = pd.Series([0, np.nan, '', None]) +example1.isnull() +``` +``` +0 False +1 True +2 False +3 True +dtype: bool +``` +출력값을 자세히 살펴보세요. 놀랐나요? `0`은 산술 null이지만 그럼에도 불구하고 완벽하게 좋은 정수이고 pandas는 이를 그대로 취급합니다. `''`는 조금 더 미묘합니다. 섹션 1에서 빈 문자열 값을 나타내기 위해 사용했지만 pandas에 관한 한 문자열 개체이며 null 표현이 아닙니다. + +이제 이것을 바꿔서 실제로 사용하는 것과 같은 방식으로 이러한 방법을 사용하겠습니다. 부울 마스크를 ``Series`` 또는 ``DataFrame`` 인덱스로 직접 사용할 수 있으며, 이는 분리된 결측(또는 현재)치로 작업하려고 할 때 유용할 수 있습니다. + +> **추가 팁**: `isnull()` 및 `notnull()` 메서드는 모두 `DataFrame`에서 사용할 때 유사한 결과를 생성합니다. 결과와 해당 결과의 인덱스를 보여주므로 데이터와 씨름할 때 엄청난 도움이 됩니다. + +- **null 값 삭제**: 누락된 값을 식별하는 것 외에도 pandas는 `Series` 및 `DataFrame`에서 null 값을 제거하는 편리한 수단을 제공합니다. (특히 대용량 데이터 세트의 경우 다른 방법으로 처리하는 것보다 분석에서 누락된 [NA] 값을 제거하는 것이 종종 더 좋습니다.) 실제 사례를 보기위해 `example1`로 돌아가겠습니다: +```python +example1 = example1.dropna() +example1 +``` +``` +0 0 +2 +dtype: object +``` +주목할 점은 `example3[example3.notnull()]`의 출력과 같아야 합니다. 여기서 차이점은 마스킹된 값에 대한 인덱싱뿐만 아니라 `dropna`가 `Series` `example1`에서 누락된 값을 제거했다는 것입니다. + +위의 `DataFrame`은 2차원이기 때문에 데이터 삭제를 위한 더 많은 옵션을 제공합니다. + +```python +example2 = pd.DataFrame([[1, np.nan, 7], + [2, 5, 8], + [np.nan, 6, 9]]) +example2 +``` +| | 0 | 1 | 2 | +|------|---|---|---| +|0 |1.0|NaN|7 | +|1 |2.0|5.0|8 | +|2 |NaN|6.0|9 | + +(Pandas가 `NaN`을 받기 위해 두 개의 열을 float로 업캐스팅한 것을 눈치채셨나요?) + +`DataFrame`에서 단일 값을 삭제할 수 없으므로 전체 행이나 열을 삭제해야 합니다. 하고 있는 일에 따라 둘 중 하나를 수행하고 싶을 수 있으므로 pandas는 둘 모두에 대한 옵션을 제공합니다. 데이터 과학에서 열은 일반적으로 변수를 나타내고 행은 관찰을 나타내므로 데이터 행을 삭제할 가능성이 더 큽니다. 'dropna()'의 기본 설정은 null 값을 포함하는 모든 행을 삭제하는 것입니다: + +```python +example2.dropna() +``` +``` + 0 1 2 +1 2.0 5.0 8 +``` +필요한 경우 열에서 NA 값을 삭제할 수 있습니다. 이렇게 하려면 `axis=1`을 사용하세요: +```python +example2.dropna(axis='columns') +``` +``` + 2 +0 7 +1 8 +2 9 +``` +이 경우 특히 소규모 데이터셋에서 보관하고자 하는 많은 데이터가 삭제될 수 있습니다. null 값이 여러 개 또는 모두 포함된 행이나 열을 삭제하려는 경우 어떻게 해야 할까요? `how` 및 `thresh` 매개변수를 사용하여 `dropna`에서 이러한 설정을 지정합니다. + +기본적으로 `how='any'`(자신을 확인하거나 메소드에 어떤 다른 매개변수가 있는지 확인하려면 코드 셀에서 `example4.dropna?`를 실행하세요). 또는 모든 null 값을 포함하는 행이나 열만 삭제하도록 `how='all'`을 지정할 수 있습니다. 예제 `DataFrame`을 확장하여 이것이 실제로 작동하는지 살펴보겠습니다. + +```python +example2[3] = np.nan +example2 +``` +| |0 |1 |2 |3 | +|------|---|---|---|---| +|0 |1.0|NaN|7 |NaN| +|1 |2.0|5.0|8 |NaN| +|2 |NaN|6.0|9 |NaN| + +`thresh` 매개변수는 더 세분화된 컨트롤을 제공합니다. 행 또는 열이 유지하기 위해 가져야 하는 *null이 아닌* 값의 수를 설정합니다: +```python +example2.dropna(axis='rows', thresh=3) +``` +``` + 0 1 2 3 +1 2.0 5.0 8 NaN +``` +여기에서 첫 번째 행과 마지막 행은 null이 아닌 값이 두 개만 포함되어 있기 때문에 삭제되었습니다. + +- **null 값 채우기**: 데이터셋에 따라 null 값을 삭제하는 대신 유효한 값으로 채우는 것이 더 합리적일 수 있습니다. `isnull`을 사용하여 이 작업을 수행할 수 있지만 특히 채울 값이 많은 경우 힘들 수 있습니다. 이것은 데이터 과학에서 일반화된 작업입니다. pandas는 누락된 값이 선택한 값으로 대체된 'Series' 또는 'DataFrame'의 복사본을 반환하는 'fillna'를 제공합니다. 이것이 실제로 어떻게 작동하는지 보기 위해 또 다른 예제 `Series`를 만들어 보겠습니다. +```python +example3 = pd.Series([1, np.nan, 2, None, 3], index=list('abcde')) +example3 +``` +``` +a 1.0 +b NaN +c 2.0 +d NaN +e 3.0 +dtype: float64 +``` +`0`과 같은 단일 값으로 모든 null 항목을 채울 수 있습니다: +```python +example3.fillna(0) +``` +``` +a 1.0 +b 0.0 +c 2.0 +d 0.0 +e 3.0 +dtype: float64 +``` +결측치를 **정방향 채우기**로 null 값을 채워나갈 수 있습니다. 즉, 마지막 유효 값을 사용하여 null을 채웁니다. + +```python +example3.fillna(method='ffill') +``` +``` +a 1.0 +b 1.0 +c 2.0 +d 2.0 +e 3.0 +dtype: float64 +``` +또한 **역방향 채우기**로 null을 채울 수도 있습니다: + +```python +example3.fillna(method='bfill') +``` +``` +a 1.0 +b 2.0 +c 2.0 +d 3.0 +e 3.0 +dtype: float64 +``` +짐작할 수 있듯이 이것은 `DataFrame`과 동일하게 작동하지만 null 값을 채울 `axis(축)`을 지정할 수도 있습니다. 이전에 사용한 `example2`를 다시 가져오겠습니다: +```python +example2.fillna(method='ffill', axis=1) +``` +``` + 0 1 2 3 +0 1.0 1.0 7.0 7.0 +1 2.0 5.0 8.0 8.0 +2 NaN 6.0 9.0 9.0 +``` +정방향 채우기에 이전 값을 사용할 수 없는 경우 null 값이 유지됩니다. + +> **추가 팁:** 데이터셋의 결측값을 처리하는 방법에는 여러 가지가 있습니다. 사용하는 특정 전략(제거, 교체 또는 교체 방법)은 해당 데이터의 세부 사항에 따라 결정되어야 합니다. 데이터셋을 처리하고 상호 작용하면 할수록 누락된 값을 처리하는 방법에 대한 더 나은 감각을 개발할 수 있습니다. + +## 중복 데이터 제거 + +> **학습 목표:** 해당 섹션이 끝나고, DataFrames에서 중복 값을 식별하고 제거하는 데 익숙해집니다. + +누락된 데이터 외에도 실제 데이터 세트에서 중복 데이터를 자주 접하게 됩니다. 다행히 `pandas`는 중복 항목을 쉽게 감지하고 제거할 수 있는 수단을 제공합니다. + +- **중복 식별: `duplicated`**: pandas의 `duplicated` 메서드를 사용하여 중복 값을 쉽게 찾을 수 있습니다. 이 메서드는 `DataFrame`의 항목이 이전 항목의 중복 항목인지 여부를 나타내는 부울 마스크를 반환합니다. 이 동작을 보기 위해 또 다른 예제 `DataFrame`을 만들어 보겠습니다. +```python +example4 = pd.DataFrame({'letters': ['A','B'] * 2 + ['B'], + 'numbers': [1, 2, 1, 3, 3]}) +example4 +``` +| |letters|numbers| +|------|-------|-------| +|0 |A |1 | +|1 |B |2 | +|2 |A |1 | +|3 |B |3 | +|4 |B |3 | + +```python +example4.duplicated() +``` +``` +0 False +1 False +2 True +3 False +4 True +dtype: bool +``` +- **중복 삭제: `drop_duplicates`:** 모든 `중복된(duplicated)` 값이 `False`인 데이터의 복사본을 반환합니다: +```python +example4.drop_duplicates() +``` +``` + letters numbers +0 A 1 +1 B 2 +3 B 3 +``` +`duplicated` 및 `drop_duplicates`는 기본적으로 모든 열을 고려하지만 `DataFrame`에서 열의 하위 집합만 검사하도록 지정할 수 있습니다.: +```python +example4.drop_duplicates(['letters']) +``` +``` +letters numbers +0 A 1 +1 B 2 +``` + +> **추가 팁:** 중복 데이터를 제거하는 것은 거의 모든 데이터 과학 프로젝트에서 필수적인 부분입니다. 중복 데이터는 분석 결과를 변경하고 부정확한 결과를 제공할 수 있습니다! + + +## 🚀 도전과제 + +논의된 모든 자료는 [Jupyter Notebook](https://github.com/microsoft/Data-Science-For-Beginners/blob/main/2-Working-With-Data/08-data-preparation/notebook.ipynb)으로 제공됩니다. 또한, 각 섹션 후에 연습 문제가 있으므로 시도해 보세요! + +## [강의 후 퀴즈](https://red-water-0103e7a0f.azurestaticapps.net/quiz/15) + + + +## 리뷰 & 복습 + +분석 및 모델링을 위해 데이터를 준비하고 접근하는 방법에는 여러 가지가 있으며, 데이터 정리는 "실제" 경험인 중요한 단계입니다. 이 강의에서 다루지 않은 기술을 살펴보기 위해 Kaggle의 관련 챌린지를 시도하세요!. + +- [데이터 정제 과제: 날짜 구문 분석](https://www.kaggle.com/rtatman/data-cleaning-challenge-parsing-dates/) + +- [데이터 정제 과제: 데이터 확장 및 정규화](https://www.kaggle.com/rtatman/data-cleaning-challenge-scale-and-normalize-data) + + +## 과제 + +[특정 양식에서의 데이터 평가](../assignment.md) From bcfe3d690a21300e0caf8fd2399c0f9728bc3095 Mon Sep 17 00:00:00 2001 From: poo Date: Tue, 14 Dec 2021 08:52:46 +0900 Subject: [PATCH 11/13] Fix code : reflect on the code review. Signed-off-by: poo --- .../07-python/translations/README.ko.md | 22 +++++++++---------- .../translations/README.ko.md | 4 ++-- 2-Working-With-Data/translations/README.ko.md | 8 +++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/2-Working-With-Data/07-python/translations/README.ko.md b/2-Working-With-Data/07-python/translations/README.ko.md index 7e2aa975..d2e52832 100644 --- a/2-Working-With-Data/07-python/translations/README.ko.md +++ b/2-Working-With-Data/07-python/translations/README.ko.md @@ -88,9 +88,9 @@ ax = monthly.plot(kind='bar') ``` ![Monthly Time Series Averages](../images/timeseries-3.png) -### 데이터프레임 +### 데이터프레임(DataFrame) -데이터프레임은 기본적으로 동일한 인덱스를 가진 시리즈 모음입니다. 여러 시리즈를 데이터프레임으로 결합할 수 있습니다: +데이터프레임(DataFrame)은 기본적으로 동일한 인덱스를 가진 시리즈 모음입니다. 여러 시리즈를 DataFrame으로 결합할 수 있습니다: ```python a = pd.Series(range(1,10)) b = pd.Series(["I","like","to","play","games","and","will","not","change"],index=range(0,9)) @@ -126,15 +126,15 @@ df = pd.DataFrame([a,b]).T..rename(columns={ 0 : 'A', 1 : 'B' }) ``` 여기서 `.T`는 행과 열을 변경하는 DataFrame을 전치하는 작업, 즉 행과 열을 변경하는 작업을 의미하며 `rename` 작업을 사용하면 이전 예제와 일치하도록 열 이름을 바꿀 수 있습니다. -다음은 데이터프레임에서 수행할 수 있는 몇 가지 가장 중요한 작업입니다: +다음은 DataFrame에서 수행할 수 있는 몇 가지 가장 중요한 작업입니다: -**특정 컬럼 선택(Column selection)**. `df['A']`를 작성하여 개별 열을 선택할 수 있습니다. 이 작업은 시리즈를 반환합니다. 또한 `df[['B','A']]`를 작성하여 열의 하위 집합을 다른 데이터프레임으로 선택할 수 있습니다. 그러면 다른 데이터프레임이 반환됩니다. +**특정 컬럼 선택(Column selection)**. `df['A']`를 작성하여 개별 열을 선택할 수 있습니다. 이 작업은 시리즈를 반환합니다. 또한 `df[['B','A']]`를 작성하여 열의 하위 집합을 다른 DataFrame으로 선택할 수 있습니다. 그러면 다른 DataFrame이 반환됩니다. **필터링(Filtering)** 은 기준에 따라 특정 행만 적용합니다. 예를 들어 `A` 열이 5보다 큰 행만 남기려면 `df[df['A']>5]`라고 쓸 수 있습니다. -> **주의**: 필터링이 작동하는 방식은 다음과 같습니다. 표현식 `df['A']<5`는 원래 시리즈 `df['A']`의 각 요소에 대해 표현식이 `True`인지 아니면 `False`인지를 나타내는 `부울(Boolean)` 시리즈를 반환합니다. 부울 계열이 인덱스로 사용되면 데이터프레임에서 행의 하위 집합을 반환합니다. 따라서 임의의 Python 부울 표현식을 사용할 수 없습니다. 예를 들어 `df[df['A']>5 및 df['A']<7]`를 작성하는 것은 잘못된 것입니다. 대신, 부울 계열에 특수 `&` 연산을 사용하여 `df[(df['A']>5) & (df['A']<7)]`로 작성해야 합니다(*여기서 대괄호가 중요합니다*). +> **주의**: 필터링이 작동하는 방식은 다음과 같습니다. 표현식 `df['A']<5`는 원래 시리즈 `df['A']`의 각 요소에 대해 표현식이 `True`인지 아니면 `False`인지를 나타내는 `부울(Boolean)` 시리즈를 반환합니다. 부울 계열이 인덱스로 사용되면 DataFrame에서 행의 하위 집합을 반환합니다. 따라서 임의의 Python 부울 표현식을 사용할 수 없습니다. 예를 들어 `df[df['A']>5 및 df['A']<7]`를 작성하는 것은 잘못된 것입니다. 대신, 부울 계열에 특수 `&` 연산을 사용하여 `df[(df['A']>5) & (df['A']<7)]`로 작성해야 합니다(*여기서 대괄호가 중요합니다*). -**새로운 계산 가능한 열 만들기**. 우리는 직관적인 표현을 사용하여 데이터프레임에 대한 새로운 계산 가능한 열을 쉽게 만들 수 있습니다.: +**새로운 계산 가능한 열 만들기**. 우리는 직관적인 표현을 사용하여 DataFrame에 대한 새로운 계산 가능한 열을 쉽게 만들 수 있습니다.: ```python df['DivA'] = df['A']-df['A'].mean() ``` @@ -152,7 +152,7 @@ df['LenB'] = df['B'].apply(lambda x : len(x)) df['LenB'] = df['B'].apply(len) ``` -위의 작업 후에 다음과 같은 데이터프레임이 완성됩니다: +위의 작업 후에 다음과 같은 DataFrame이 완성됩니다: | | A | B | DivA | LenB | | --- | --- | ------ | ---- | ---- | @@ -166,12 +166,12 @@ df['LenB'] = df['B'].apply(len) | 7 | 8 | very | 3.0 | 4 | | 8 | 9 | much | 4.0 | 4 | -**숫자를 기준으로 행 선택** `iloc(정수 위치:integer location)` 구성을 사용하여 수행할 수 있습니다. 예를 들어 데이터프레임에서 처음 5개 행을 선택하려면: +**숫자를 기준으로 행 선택** `iloc(정수 위치:integer location)` 구성을 사용하여 수행할 수 있습니다. 예를 들어 DataFrame에서 처음 5개 행을 선택하려면: ```python df.iloc[:5] ``` -**그룹화(Grouping)** 는 종종 Excel의 *피벗 테이블*과 유사한 결과를 얻는 데 사용됩니다. 주어진 `LenB` 수에 대해 `A` 열의 평균 값을 계산하려고 한다고 가정합니다. 그런 다음 `LenB`로 데이터프레임을 그룹화하고 `mean`을 호출할 수 있습니다: +**그룹화(Grouping)** 는 종종 Excel의 *피벗 테이블*과 유사한 결과를 얻는 데 사용됩니다. 주어진 `LenB` 수에 대해 `A` 열의 평균 값을 계산하려고 한다고 가정합니다. 그런 다음 `LenB`로 DataFrame을 그룹화하고 `mean`을 호출할 수 있습니다: ```python df.groupby(by='LenB').mean() ``` @@ -193,7 +193,7 @@ This gives us the following table: ### 데이터 얻기 -우리는 Python 객체에서 시리즈 및 데이터프레임을 구성하는 것이 얼마나 쉬운지 보았습니다. 그러나 데이터는 일반적으로 텍스트 파일 또는 Excel 표의 형태로 제공됩니다. 운 좋게도 Pandas는 디스크에서 데이터를 로드하는 간단한 방법을 제공합니다. 예를 들어 CSV 파일을 읽는 것은 다음과 같이 간단합니다: +우리는 Python 객체에서 시리즈 및 DataFrame을 구성하는 것이 얼마나 쉬운지 보았습니다. 그러나 데이터는 일반적으로 텍스트 파일 또는 Excel 표의 형태로 제공됩니다. 운 좋게도 Pandas는 디스크에서 데이터를 로드하는 간단한 방법을 제공합니다. 예를 들어 CSV 파일을 읽는 것은 다음과 같이 간단합니다: ```python df = pd.read_csv('file.csv') ``` @@ -202,7 +202,7 @@ df = pd.read_csv('file.csv') ### 출력(Printing) 및 플로팅(Plotting) -데이터 과학자는 종종 데이터를 탐색해야 하므로 시각화할 수 있는 것이 중요합니다. 데이터프레임이 클 때 처음 몇 행을 인쇄하여 모든 작업을 올바르게 수행하고 있는지 확인하려는 경우가 많습니다. 이것은 `df.head()`를 호출하여 수행할 수 있습니다. Jupyter Notebook에서 실행하는 경우 데이터프레임을 멋진 표 형식으로 인쇄합니다. +데이터 과학자는 종종 데이터를 탐색해야 하므로 시각화할 수 있는 것이 중요합니다. DataFrame이 클 때 처음 몇 행을 인쇄하여 모든 작업을 올바르게 수행하고 있는지 확인하려는 경우가 많습니다. 이것은 `df.head()`를 호출하여 수행할 수 있습니다. Jupyter Notebook에서 실행하는 경우 DataFrame을 멋진 표 형식으로 인쇄합니다. 또한 일부 열을 시각화하기 위해 'plot' 함수를 사용하는 것을 보았습니다. `plot`은 많은 작업에 매우 유용하고 `kind=` 매개변수를 통해 다양한 그래프 유형을 지원하지만, 항상 원시 `matplotlib` 라이브러리를 사용하여 더 복잡한 것을 그릴 수 있습니다. 데이터 시각화는 별도의 강의에서 자세히 다룰 것입니다. diff --git a/2-Working-With-Data/08-data-preparation/translations/README.ko.md b/2-Working-With-Data/08-data-preparation/translations/README.ko.md index 9844a6cb..9d425fee 100644 --- a/2-Working-With-Data/08-data-preparation/translations/README.ko.md +++ b/2-Working-With-Data/08-data-preparation/translations/README.ko.md @@ -8,7 +8,7 @@ -원본에 따라 원시 데이터에는 분석 및 모델링에 문제를 일으킬 수 있는 일부 불일치 요소가 포함될 수 있습니다. 즉, 이 데이터는 "더티"로 분류될 수 있으며 사전에 처리해야 합니다. 이 단원에서는 누락, 혹은 부정확하거나 불완전한 데이터의 문제를 처리하기 위해 데이터를 정리하고 변환하는 기술에 중점을 둡니다. 이 강의에서 다루는 주제는 Python과 Pandas 라이브러리를 활용하며 이 디렉토리의 [notebook](notebook.ipynb)에서 시연됩니다. +원본에 따라 원시 데이터에는 분석 및 모델링에 문제를 일으킬 수 있는 일부 불일치 요소가 포함될 수 있습니다. 즉, 이 데이터는 "더티"로 분류될 수 있으며 사전에 처리해야 합니다. 이 단원에서는 누락, 혹은 부정확하거나 불완전한 데이터의 문제를 처리하기 위해 데이터를 정리하고 변환하는 기술에 중점을 둡니다. 이 강의에서 다루는 주제는 Python과 Pandas 라이브러리를 활용하며 이 디렉토리의 [notebook](../notebook.ipynb)에서 시연됩니다. ## 정제 데이터의 중요성 @@ -31,7 +31,7 @@ ## DataFrame 정보 탐색 > **학습 목표:** 하위 섹션이 끝날때까지, pandas DataFrame에 저장된 데이터에 대한 정보를 능숙하게 찾을 수 있을 것입니다. -데이터를 pandas에 로드하면 DataFrame에 없을 가능성이 더 높아집니다(이전 [단원](https://github.com/microsoft/Data-Science-For-Beginners/tree/main/2-Working-With-Data/07-python#dataframe) 참조. 그러나 DataFrame에 있는 데이터셋에 60,000개의 행과 400개의 열이 있는 경우). 다행스럽게도 [pandas](https://pandas.pydata.org/)는 처음 몇 행과 마지막 몇 행 외에도 DataFrame에 대한 전체 정보를 빠르게 볼 수 있는 몇 가지 편리한 도구를 제공합니다. +데이터를 pandas에 로드하면 DataFrame에 없을 가능성이 더 높아집니다(이전 [단원](https://github.com/microsoft/Data-Science-For-Beginners/tree/main/2-Working-With-Data/07-python/translations/README.ko.md#데이터프레임) 참조. 그러나 DataFrame에 있는 데이터셋에 60,000개의 행과 400개의 열이 있는 경우). 다행스럽게도 [pandas](https://pandas.pydata.org/)는 처음 몇 행과 마지막 몇 행 외에도 DataFrame에 대한 전체 정보를 빠르게 볼 수 있는 몇 가지 편리한 도구를 제공합니다. 이 기능을 살펴보기 위해 Python scikit-learn 라이브러리를 가져오고 상징적인 데이터셋인 **Iris 데이터셋** 을 사용합니다. diff --git a/2-Working-With-Data/translations/README.ko.md b/2-Working-With-Data/translations/README.ko.md index 7c294d53..7d840d50 100644 --- a/2-Working-With-Data/translations/README.ko.md +++ b/2-Working-With-Data/translations/README.ko.md @@ -7,10 +7,10 @@ ### 주제 -1. [관계형 데이터베이스](05-relational-databases/README.md) -2. [비관계형 데이터베이스](06-non-relational/README.md) -3. [Python 활용하기](07-python/README.md) -4. [데이터 준비](08-data-preparation/README.md) +1. [관계형 데이터베이스](05-relational-databases/translation/README.ko.md) +2. [비관계형 데이터베이스](06-non-relational/translation/README.ko.md) +3. [Python 활용하기](07-python/translation/README.ko.md) +4. [데이터 준비](08-data-preparation/translation/README.ko.md) ### 크레딧 From b852612551c9be4f6578186ec2af2819155ea4b7 Mon Sep 17 00:00:00 2001 From: poo Date: Tue, 14 Dec 2021 09:02:27 +0900 Subject: [PATCH 12/13] fix link Signed-off-by: poo --- .../08-data-preparation/translations/README.ko.md | 2 +- 2-Working-With-Data/translations/README.ko.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/2-Working-With-Data/08-data-preparation/translations/README.ko.md b/2-Working-With-Data/08-data-preparation/translations/README.ko.md index 9d425fee..fbc48870 100644 --- a/2-Working-With-Data/08-data-preparation/translations/README.ko.md +++ b/2-Working-With-Data/08-data-preparation/translations/README.ko.md @@ -31,7 +31,7 @@ ## DataFrame 정보 탐색 > **학습 목표:** 하위 섹션이 끝날때까지, pandas DataFrame에 저장된 데이터에 대한 정보를 능숙하게 찾을 수 있을 것입니다. -데이터를 pandas에 로드하면 DataFrame에 없을 가능성이 더 높아집니다(이전 [단원](https://github.com/microsoft/Data-Science-For-Beginners/tree/main/2-Working-With-Data/07-python/translations/README.ko.md#데이터프레임) 참조. 그러나 DataFrame에 있는 데이터셋에 60,000개의 행과 400개의 열이 있는 경우). 다행스럽게도 [pandas](https://pandas.pydata.org/)는 처음 몇 행과 마지막 몇 행 외에도 DataFrame에 대한 전체 정보를 빠르게 볼 수 있는 몇 가지 편리한 도구를 제공합니다. +데이터를 pandas에 로드하면 DataFrame에 없을 가능성이 더 높아집니다(이전 [단원](../../07-python/translations/README.ko.md#데이터프레임) 참조. 그러나 DataFrame에 있는 데이터셋에 60,000개의 행과 400개의 열이 있는 경우). 다행스럽게도 [pandas](https://pandas.pydata.org/)는 처음 몇 행과 마지막 몇 행 외에도 DataFrame에 대한 전체 정보를 빠르게 볼 수 있는 몇 가지 편리한 도구를 제공합니다. 이 기능을 살펴보기 위해 Python scikit-learn 라이브러리를 가져오고 상징적인 데이터셋인 **Iris 데이터셋** 을 사용합니다. diff --git a/2-Working-With-Data/translations/README.ko.md b/2-Working-With-Data/translations/README.ko.md index 7d840d50..97524fee 100644 --- a/2-Working-With-Data/translations/README.ko.md +++ b/2-Working-With-Data/translations/README.ko.md @@ -7,10 +7,10 @@ ### 주제 -1. [관계형 데이터베이스](05-relational-databases/translation/README.ko.md) -2. [비관계형 데이터베이스](06-non-relational/translation/README.ko.md) -3. [Python 활용하기](07-python/translation/README.ko.md) -4. [데이터 준비](08-data-preparation/translation/README.ko.md) +1. [관계형 데이터베이스](../05-relational-databases/translation/README.ko.md) +2. [비관계형 데이터베이스](../06-non-relational/translation/README.ko.md) +3. [Python 활용하기](../07-python/translation/README.ko.md) +4. [데이터 준비](../08-data-preparation/translation/README.ko.md) ### 크레딧 From cf9538735b0c1a15257dda2835ef4408305dde2b Mon Sep 17 00:00:00 2001 From: poo Date: Tue, 14 Dec 2021 09:05:18 +0900 Subject: [PATCH 13/13] Fix link(2) Signed-off-by: poo --- 2-Working-With-Data/translations/README.ko.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2-Working-With-Data/translations/README.ko.md b/2-Working-With-Data/translations/README.ko.md index 97524fee..083e039b 100644 --- a/2-Working-With-Data/translations/README.ko.md +++ b/2-Working-With-Data/translations/README.ko.md @@ -7,10 +7,10 @@ ### 주제 -1. [관계형 데이터베이스](../05-relational-databases/translation/README.ko.md) -2. [비관계형 데이터베이스](../06-non-relational/translation/README.ko.md) -3. [Python 활용하기](../07-python/translation/README.ko.md) -4. [데이터 준비](../08-data-preparation/translation/README.ko.md) +1. [관계형 데이터베이스](../05-relational-databases/translations/README.ko.md) +2. [비관계형 데이터베이스](../06-non-relational/translations/README.ko.md) +3. [Python 활용하기](../07-python/translations/README.ko.md) +4. [데이터 준비](../08-data-preparation/translations/README.ko.md) ### 크레딧