<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>서윤로그</title>
    <link>https://sy-log.tistory.com/</link>
    <description>미래의 나를 위한 아카이빙 블로그
(E-mail: leesymiu@gmail.com)</description>
    <language>ko</language>
    <pubDate>Tue, 26 May 2026 13:53:23 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>서윤L</managingEditor>
    <image>
      <title>서윤로그</title>
      <url>https://tistory1.daumcdn.net/tistory/4609604/attach/9360ee109548467099d49a216e405be0</url>
      <link>https://sy-log.tistory.com</link>
    </image>
    <item>
      <title>[MySQL] SQL 숫자형함수 사용예시 (ABS, ROUND, CEIL, FLOOR, MOD, POWER, SQRT)</title>
      <link>https://sy-log.tistory.com/entry/MySQL-SQL-%EC%88%AB%EC%9E%90%ED%98%95%ED%95%A8%EC%88%98-%EC%82%AC%EC%9A%A9%EC%98%88%EC%8B%9C-ABS-ROUND-CEIL-FLOOR-MOD-POWER-SQRT</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 절댓값&amp;nbsp; ::&amp;nbsp; ABS&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT ABS(숫자) &amp;rArr; 입력한 숫자의 절댓값을 반환&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 28.4884%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ABS 예시 (1)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 71.5116%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;731&quot; data-origin-height=&quot;187&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/xQKBp/btsI3Q7lyyz/N83kO1BlcqW6TgJB3wBkrK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/xQKBp/btsI3Q7lyyz/N83kO1BlcqW6TgJB3wBkrK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/xQKBp/btsI3Q7lyyz/N83kO1BlcqW6TgJB3wBkrK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FxQKBp%2FbtsI3Q7lyyz%2FN83kO1BlcqW6TgJB3wBkrK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;434&quot; height=&quot;111&quot; data-origin-width=&quot;731&quot; data-origin-height=&quot;187&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 28.4884%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ABS 예시 (2)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 71.5116%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;747&quot; data-origin-height=&quot;181&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c8gxFZ/btsI3NW8vsT/0hkTxtGsiR0yOF3UNKsx8K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c8gxFZ/btsI3NW8vsT/0hkTxtGsiR0yOF3UNKsx8K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c8gxFZ/btsI3NW8vsT/0hkTxtGsiR0yOF3UNKsx8K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc8gxFZ%2FbtsI3NW8vsT%2F0hkTxtGsiR0yOF3UNKsx8K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;437&quot; height=&quot;106&quot; data-origin-width=&quot;747&quot; data-origin-height=&quot;181&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 반올림&amp;nbsp; ::&amp;nbsp; ROUND&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT ROUND(숫자, N) &amp;rArr; 입력한 숫자의 소숫점 아래 N의 자리까지 반올림한 값을 반환&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 29.1861%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ROUND 예시 (1)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 70.8139%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;740&quot; data-origin-height=&quot;202&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Jv72P/btsI2j31p6f/1jucSrjRXPKiHjEKwbRS4k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Jv72P/btsI2j31p6f/1jucSrjRXPKiHjEKwbRS4k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Jv72P/btsI2j31p6f/1jucSrjRXPKiHjEKwbRS4k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJv72P%2FbtsI2j31p6f%2F1jucSrjRXPKiHjEKwbRS4k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;431&quot; height=&quot;118&quot; data-origin-width=&quot;740&quot; data-origin-height=&quot;202&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 29.1861%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ROUND 예시 (2)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 70.8139%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;742&quot; data-origin-height=&quot;195&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bEjKno/btsI3NXa6s8/oltWbhHzAHv3E3lpsuwAB0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bEjKno/btsI3NXa6s8/oltWbhHzAHv3E3lpsuwAB0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bEjKno/btsI3NXa6s8/oltWbhHzAHv3E3lpsuwAB0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbEjKno%2FbtsI3NXa6s8%2FoltWbhHzAHv3E3lpsuwAB0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;436&quot; height=&quot;115&quot; data-origin-width=&quot;742&quot; data-origin-height=&quot;195&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 올림 / 내림&amp;nbsp; ::&amp;nbsp; CEIL / FLOOR&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT CEIL(숫자) : 입력한 숫자의 올림값(정수)를 반환&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT FLOOR(숫자) : 입력한 숫자의 내림값(정수)를 반환&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 31.7442%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;CEIL 예시&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 68.2558%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;745&quot; data-origin-height=&quot;189&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/qjneD/btsI4cWvZmD/GnrzbJJsoqwfOKFJh9PpS1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/qjneD/btsI4cWvZmD/GnrzbJJsoqwfOKFJh9PpS1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/qjneD/btsI4cWvZmD/GnrzbJJsoqwfOKFJh9PpS1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FqjneD%2FbtsI4cWvZmD%2FGnrzbJJsoqwfOKFJh9PpS1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;444&quot; height=&quot;113&quot; data-origin-width=&quot;745&quot; data-origin-height=&quot;189&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 31.7442%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;FLOOR 예시&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 68.2558%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;185&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b4xKK3/btsI2kvePx5/q2K1gffJKkr176gnlykiV1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b4xKK3/btsI2kvePx5/q2K1gffJKkr176gnlykiV1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b4xKK3/btsI2kvePx5/q2K1gffJKkr176gnlykiV1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb4xKK3%2FbtsI2kvePx5%2Fq2K1gffJKkr176gnlykiV1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;443&quot; height=&quot;112&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;185&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣&lt;/b&gt;&lt;b&gt;&amp;nbsp; 나머지&amp;nbsp; ::&amp;nbsp; MOD&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT MOD(a, b) &amp;rArr; a를 b로 나눈 나머지값을 반환&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 32.2093%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;MOD 예시 (1)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 67.7907%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;742&quot; data-origin-height=&quot;204&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dZEXNu/btsI2Q7VRjr/CLvDAnmckTlOJ2dojcHHxk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dZEXNu/btsI2Q7VRjr/CLvDAnmckTlOJ2dojcHHxk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dZEXNu/btsI2Q7VRjr/CLvDAnmckTlOJ2dojcHHxk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdZEXNu%2FbtsI2Q7VRjr%2FCLvDAnmckTlOJ2dojcHHxk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;425&quot; height=&quot;117&quot; data-origin-width=&quot;742&quot; data-origin-height=&quot;204&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 32.2093%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;MOD 예시 (2)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 67.7907%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;734&quot; data-origin-height=&quot;201&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/D9C6C/btsI3XytcoK/yBna75Rlaj8emDSIdIf6x1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/D9C6C/btsI3XytcoK/yBna75Rlaj8emDSIdIf6x1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/D9C6C/btsI3XytcoK/yBna75Rlaj8emDSIdIf6x1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FD9C6C%2FbtsI3XytcoK%2FyBna75Rlaj8emDSIdIf6x1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;427&quot; height=&quot;117&quot; data-origin-width=&quot;734&quot; data-origin-height=&quot;201&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;5️⃣&lt;/b&gt;&lt;b&gt;&amp;nbsp; 거듭제곱&amp;nbsp; ::&amp;nbsp; POWER&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT POWER(숫자, N) &amp;rArr; 입력한 숫자를 N번 거듭제곱한 값을 반환 (입력한 숫자의 N승)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 30.6977%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;POWER 예시 (1)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 69.3023%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;749&quot; data-origin-height=&quot;204&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/IF3Oz/btsI24LO1vZ/jpmSEPLPenUANKTKTawmAk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/IF3Oz/btsI24LO1vZ/jpmSEPLPenUANKTKTawmAk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/IF3Oz/btsI24LO1vZ/jpmSEPLPenUANKTKTawmAk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FIF3Oz%2FbtsI24LO1vZ%2FjpmSEPLPenUANKTKTawmAk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;425&quot; height=&quot;116&quot; data-origin-width=&quot;749&quot; data-origin-height=&quot;204&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 30.6977%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;POWER 예시 (2)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 69.3023%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;737&quot; data-origin-height=&quot;207&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nLPhn/btsI2cKA9zb/SnXRilMoeqeI1gStieJrY0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nLPhn/btsI2cKA9zb/SnXRilMoeqeI1gStieJrY0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nLPhn/btsI2cKA9zb/SnXRilMoeqeI1gStieJrY0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnLPhn%2FbtsI2cKA9zb%2FSnXRilMoeqeI1gStieJrY0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;426&quot; height=&quot;120&quot; data-origin-width=&quot;737&quot; data-origin-height=&quot;207&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;6️⃣&lt;/b&gt;&lt;b&gt;&amp;nbsp; 제곱근&amp;nbsp; ::&amp;nbsp; SQRT&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT SQRT(숫자) &amp;rArr; 입력한 숫자의 제곱근 값을 반환&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 31.8605%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SQRT 예시 (1)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 68.1395%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;741&quot; data-origin-height=&quot;185&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ANbPd/btsI25YlMEW/etlDSWEWiaOYwCiKLwq5M0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ANbPd/btsI25YlMEW/etlDSWEWiaOYwCiKLwq5M0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ANbPd/btsI25YlMEW/etlDSWEWiaOYwCiKLwq5M0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FANbPd%2FbtsI25YlMEW%2FetlDSWEWiaOYwCiKLwq5M0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;421&quot; height=&quot;105&quot; data-origin-width=&quot;741&quot; data-origin-height=&quot;185&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 31.8605%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SQRT 예시 (2)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 68.1395%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;187&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/5pZAe/btsI3gFj53l/fCHY9EaPFSFz9c4KhyM5d1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/5pZAe/btsI3gFj53l/fCHY9EaPFSFz9c4KhyM5d1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/5pZAe/btsI3gFj53l/fCHY9EaPFSFz9c4KhyM5d1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F5pZAe%2FbtsI3gFj53l%2FfCHY9EaPFSFz9c4KhyM5d1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;420&quot; height=&quot;107&quot; data-origin-width=&quot;732&quot; data-origin-height=&quot;187&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>ABS</category>
      <category>ceil</category>
      <category>Floor</category>
      <category>Mod</category>
      <category>MySQL</category>
      <category>POWER</category>
      <category>Round</category>
      <category>SQL</category>
      <category>sql함수</category>
      <category>sqrt</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/175</guid>
      <comments>https://sy-log.tistory.com/entry/MySQL-SQL-%EC%88%AB%EC%9E%90%ED%98%95%ED%95%A8%EC%88%98-%EC%82%AC%EC%9A%A9%EC%98%88%EC%8B%9C-ABS-ROUND-CEIL-FLOOR-MOD-POWER-SQRT#entry175comment</comments>
      <pubDate>Tue, 13 Aug 2024 16:54:23 +0900</pubDate>
    </item>
    <item>
      <title>[MySQL] SQL 연산자 모음 및 사용예시 (BETWEEN, IN, LIKE, UNION, UNION ALL)</title>
      <link>https://sy-log.tistory.com/entry/MySQL-SQL-%EC%97%B0%EC%82%B0%EC%9E%90-%EB%AA%A8%EC%9D%8C-%EB%B0%8F-%EC%82%AC%EC%9A%A9%EC%98%88%EC%8B%9C-BETWEEN-IN-LIKE-UNION-UNION-ALL</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ SQL 연산자 종류&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 456px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 35.1162%; height: 17px; text-align: center;&quot; colspan=&quot;2&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;연산자 구분&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;연산자&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;연산자 설명&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 35.1162%; height: 108px; text-align: center;&quot; colspan=&quot;2&quot; rowspan=&quot;6&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;비교 연산자&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;=&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;같음&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;보다 큼 (초과)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&amp;lt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;보다 작음 (미만)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&amp;gt;=&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;보다 크거나 같음 (이상)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&amp;lt;=&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;보다 작거나 같음 (이하)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&amp;lt;&amp;gt; , !=&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;같지 않음&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;height: 54px; text-align: center; width: 35.1162%;&quot; colspan=&quot;2&quot; rowspan=&quot;3&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;논리 연산자&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;AND&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;AND 앞뒤의 조건을 모두 만족할 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;OR&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;OR 앞뒤의 조건 중 하나라도 만족할 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;NOT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;NOT 뒤의 조건과 반대일 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 35.1162%; height: 72px;&quot; colspan=&quot;2&quot; rowspan=&quot;4&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;산술 연산자&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;+&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;덧셈&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;-&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;뺄셈&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;*&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;곱셈&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;/&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;나눗셈&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 35.1162%; height: 34px;&quot; colspan=&quot;2&quot; rowspan=&quot;2&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;집합 연산자&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;UNION&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;2개 이상의 테이블의 합집합 (중복 행은 제거함)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;UNION ALL&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;2개 이상의 테이블을 중복행 포함해 합침&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 19.1471%; text-align: center; height: 171px;&quot; rowspan=&quot;10&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;특수 연산자&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 15.9691%; text-align: center; height: 34px;&quot; rowspan=&quot;2&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;BETWEEN&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;BETWEEN a AND b&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;a와 b의 값 사이&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;NOT BETWEEN a AND b&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;a와 b의 값 사이가 아님&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 15.9691%; text-align: center; height: 34px;&quot; rowspan=&quot;2&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;IN&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;IN (List)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;리스트에 포함됨 값일 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;NOT IN (List)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;리스트에 포함된 값이 아닐 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 15.9691%; text-align: center; height: 68px;&quot; rowspan=&quot;4&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;LIKE&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;LIKE 'A%'&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;문자열이 A로 시작하는&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;LIKE '%A'&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;문자열이 A로 끝나는&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;LIKE '%A%'&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;문자열이 A를 포함하는&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;NOT LIKE '%A%'&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;문자열이 A를 포함하지 않는&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 15.9691%; text-align: center; height: 35px;&quot; rowspan=&quot;2&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;IS NULL&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 17px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;NULL과 같을 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 26.8992%; text-align: center; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;IS NOT NULL&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 37.9845%; height: 18px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;NULL이 아닐 때&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 집합 연산자 UNION , UNION ALL&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;집합 연산자를 사용하려면, 대상 테이블들의 &lt;b&gt;열 개수와 데이터타입이 일치&lt;/b&gt;해야 합니다. 테이블들을 위아래로 붙이는 셈이니까요.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;명령어는 아래 예시처럼 &lt;b&gt;SELECT문 사이에&lt;/b&gt; 써줍니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 98.6048%; height: 108px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 20px;&quot;&gt;
&lt;td style=&quot;width: 50.6952%; text-align: center; height: 20px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;UNION&lt;/span&gt;&lt;/b&gt; &lt;/b&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 47.5667%; text-align: center; height: 20px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; &lt;b&gt;&lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;UNION ALL&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 88px;&quot;&gt;
&lt;td style=&quot;width: 50.6952%; height: 88px;&quot;&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2개 이상의 테이블에서 UNION을 사용하면, &lt;br /&gt;테이블간 중복되는 행은 제외시켜줍니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다시말해 2개 이상 중복되는 그대로 남겨져있지 않고&lt;br /&gt;1개만 남아있도록 정리해줍니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이렇게 중복이 제외되므로, 합쳐진 결과 테이블의 행수는&lt;br /&gt;원래 테이블들의 행수의 합보다 작을 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 47.5667%; height: 88px;&quot;&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;같은 상황에서 UNION ALL을 사용하면, &lt;br /&gt;합쳐지면서 중복되는 행이 생겨도 제외하지 않습니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;같은 데이터 행이 2개 3개 있어도 그대로 유지됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;따라서 합쳐진 결과 테이블의 행수는&lt;br /&gt;원래 테이블들의 행수의 합과 같아야 합니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: none; color: #000000;&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1199&quot; data-origin-height=&quot;1006&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/lSNMq/btsI23yxUhr/UargXP2xrmbhncPotcliUk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/lSNMq/btsI23yxUhr/UargXP2xrmbhncPotcliUk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/lSNMq/btsI23yxUhr/UargXP2xrmbhncPotcliUk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FlSNMq%2FbtsI23yxUhr%2FUargXP2xrmbhncPotcliUk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;431&quot; height=&quot;1006&quot; data-origin-width=&quot;1199&quot; data-origin-height=&quot;1006&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 특수 연산자&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특수 연산자는 &lt;b&gt;보통 WHERE 절에서 조건을 걸어, 데이터를 필터링 하는데&lt;/b&gt;에 많이 쓰입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;위에서 정리했듯이, &lt;b&gt;BETWEEN, IN, LIKE, NULL&lt;/b&gt; 등이 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-1.&amp;nbsp;&lt;/b&gt;&lt;b&gt; BETWEEN 사용예시&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;BETWEEN a AND b&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;NOT BETWEEN a AND b&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;595&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/1wLYz/btsI3hQSpzk/xswthRbNQDLTiWrZskcIOk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/1wLYz/btsI3hQSpzk/xswthRbNQDLTiWrZskcIOk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/1wLYz/btsI3hQSpzk/xswthRbNQDLTiWrZskcIOk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F1wLYz%2FbtsI3hQSpzk%2FxswthRbNQDLTiWrZskcIOk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1822&quot; height=&quot;595&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;595&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1826&quot; data-origin-height=&quot;673&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b4vGCn/btsI2FY0Kgd/qei0wROhQkkMV80Jte6RS0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b4vGCn/btsI2FY0Kgd/qei0wROhQkkMV80Jte6RS0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b4vGCn/btsI2FY0Kgd/qei0wROhQkkMV80Jte6RS0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb4vGCn%2FbtsI2FY0Kgd%2Fqei0wROhQkkMV80Jte6RS0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1826&quot; height=&quot;673&quot; data-origin-width=&quot;1826&quot; data-origin-height=&quot;673&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-2. &lt;/b&gt;&lt;b&gt;&amp;nbsp;IN&amp;nbsp;사용예시&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;주로&lt;b&gt; IN 뒤에 리스트&lt;/b&gt;를 사용하며, &lt;b&gt;이 리스트에 포함된 값인지 아닌지&lt;/b&gt;를 판단하는 조건절로 많이 쓰입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;IN (List)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;NOT IN (List)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1631&quot; data-origin-height=&quot;694&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Feh4J/btsI1xnoOYX/FNvkytZcjRthmeAtfvyF51/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Feh4J/btsI1xnoOYX/FNvkytZcjRthmeAtfvyF51/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Feh4J/btsI1xnoOYX/FNvkytZcjRthmeAtfvyF51/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFeh4J%2FbtsI1xnoOYX%2FFNvkytZcjRthmeAtfvyF51%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1631&quot; height=&quot;694&quot; data-origin-width=&quot;1631&quot; data-origin-height=&quot;694&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1631&quot; data-origin-height=&quot;703&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Kwy2T/btsI2daUrp9/nH1PW4G9e8COFnq8YZudMK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Kwy2T/btsI2daUrp9/nH1PW4G9e8COFnq8YZudMK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Kwy2T/btsI2daUrp9/nH1PW4G9e8COFnq8YZudMK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FKwy2T%2FbtsI2daUrp9%2FnH1PW4G9e8COFnq8YZudMK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1631&quot; height=&quot;703&quot; data-origin-width=&quot;1631&quot; data-origin-height=&quot;703&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-3.&amp;nbsp;&lt;/b&gt;&lt;b&gt; LIKE&amp;nbsp;사용예시&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;문자열을 기준으로 판단하고자 할 때, WHERE 조건절에서 LIKE를 사용하면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;LIKE 'S%' : S로 시작하는&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;LIKE '%N' : N으로 끝나는&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1492&quot; data-origin-height=&quot;702&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Afo9D/btsI2KFZVnP/XZJFoNK18GMg96nAQSCII0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Afo9D/btsI2KFZVnP/XZJFoNK18GMg96nAQSCII0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Afo9D/btsI2KFZVnP/XZJFoNK18GMg96nAQSCII0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FAfo9D%2FbtsI2KFZVnP%2FXZJFoNK18GMg96nAQSCII0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1492&quot; height=&quot;702&quot; data-origin-width=&quot;1492&quot; data-origin-height=&quot;702&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1498&quot; data-origin-height=&quot;704&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/XKIur/btsI2FrdISv/BoYr7q2wqK5PBIonHYWFm0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/XKIur/btsI2FrdISv/BoYr7q2wqK5PBIonHYWFm0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/XKIur/btsI2FrdISv/BoYr7q2wqK5PBIonHYWFm0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FXKIur%2FbtsI2FrdISv%2FBoYr7q2wqK5PBIonHYWFm0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1498&quot; height=&quot;704&quot; data-origin-width=&quot;1498&quot; data-origin-height=&quot;704&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;LIKE '%AE%' : AE를 포함하는&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;NOT LIKE '%EO%' : EO를 포함하지 않는&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1560&quot; data-origin-height=&quot;701&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dfzQou/btsI1RZ9itM/1gKcWyTkBvKdquy1FTLCYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dfzQou/btsI1RZ9itM/1gKcWyTkBvKdquy1FTLCYK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dfzQou/btsI1RZ9itM/1gKcWyTkBvKdquy1FTLCYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdfzQou%2FbtsI1RZ9itM%2F1gKcWyTkBvKdquy1FTLCYK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1560&quot; height=&quot;701&quot; data-origin-width=&quot;1560&quot; data-origin-height=&quot;701&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1530&quot; data-origin-height=&quot;707&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/pQl7W/btsI1EGOBqk/BvvunMz8ZGlpKNM7fle7ek/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/pQl7W/btsI1EGOBqk/BvvunMz8ZGlpKNM7fle7ek/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/pQl7W/btsI1EGOBqk/BvvunMz8ZGlpKNM7fle7ek/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FpQl7W%2FbtsI1EGOBqk%2FBvvunMz8ZGlpKNM7fle7ek%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1530&quot; height=&quot;707&quot; data-origin-width=&quot;1530&quot; data-origin-height=&quot;707&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>MySQL</category>
      <category>SQL</category>
      <category>sql between</category>
      <category>SQL LIKE</category>
      <category>SQL연산자</category>
      <category>union</category>
      <category>union all</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/174</guid>
      <comments>https://sy-log.tistory.com/entry/MySQL-SQL-%EC%97%B0%EC%82%B0%EC%9E%90-%EB%AA%A8%EC%9D%8C-%EB%B0%8F-%EC%82%AC%EC%9A%A9%EC%98%88%EC%8B%9C-BETWEEN-IN-LIKE-UNION-UNION-ALL#entry174comment</comments>
      <pubDate>Tue, 13 Aug 2024 01:18:58 +0900</pubDate>
    </item>
    <item>
      <title>[MySQL] 뷰VIEW 생성, 수정, 삭제하기 (CREATE VIEW, ALTER VIEW, DROP VIEW)</title>
      <link>https://sy-log.tistory.com/entry/MySQL-%EB%B7%B0VIEW-%EC%83%9D%EC%84%B1-%EC%88%98%EC%A0%95-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0-CREATE-VIEW-ALTER-VIEW-DROP-VIEW</link>
      <description>&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size18&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 뷰 VIEW&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;b&gt;뷰는 사용자가 정의한 &quot;가상의 테이블&quot;&lt;/b&gt; 입니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;이름 그대로, 1개 이상의 테이블에 있는 &lt;b&gt;데이터를 &quot;보여주기만 하는&quot; 용도&lt;/b&gt;입니다. 데이터를 저장하지는 않습니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;가상이긴 하지만 테이블이므로, 보통 테이블과 마찬가지로 &lt;b&gt;중복되는 열을 가질 수 없습니다.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;뷰를 생성/수정/삭제하기 위해 사용하는 명령어 또한, 테이블의 명령어와 동일합니다.&lt;br /&gt;아래와 같이 &lt;b&gt;생성할 때는 CREATE, 수정은 ALTER, 삭제는 DROP&lt;/b&gt; 을 사용합니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 뷰 생성하기 :: CREATE VIEW&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예를들어 JOIN, UNION 등의 결과물이 계속 필요한 경우, 수시로 만들지 않고 뷰에 임시저장해서 사용하면 편리합니다.&lt;br /&gt;서버를 종료하기 전까지는 테이블처럼 불러와서 사용할 수 있습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래처럼 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;&lt;b&gt;CREATE VIEW 뷰이름 AS ...&lt;/b&gt;&lt;/span&gt; 로 뷰를 생성할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1534&quot; data-origin-height=&quot;965&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6fSEr/btsI2xz71S8/WHampQKseSHLgfLp0CgWyK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6fSEr/btsI2xz71S8/WHampQKseSHLgfLp0CgWyK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6fSEr/btsI2xz71S8/WHampQKseSHLgfLp0CgWyK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6fSEr%2FbtsI2xz71S8%2FWHampQKseSHLgfLp0CgWyK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;587&quot; height=&quot;965&quot; data-origin-width=&quot;1534&quot; data-origin-height=&quot;965&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 뷰 수정하기 :: CREATE VIEW&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이미 생성한 뷰를 수정하려면 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;&lt;b&gt;ALTER VIEW 뷰이름 AS ...&lt;/b&gt;&lt;/span&gt; 를 사용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;또는 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;&lt;b&gt;CREATE OR REPLACE&lt;/b&gt;&lt;/span&gt; 를 사용해도 되는데, 뷰를 생성하거나 이미 해당 이름의 뷰가 있다면 덮어씌운다는 의미입니다.&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1954&quot; data-origin-height=&quot;965&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/d8yHuA/btsI3dAVGrW/gN7oxJJSUnDNOS4VJooak1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/d8yHuA/btsI3dAVGrW/gN7oxJJSUnDNOS4VJooak1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/d8yHuA/btsI3dAVGrW/gN7oxJJSUnDNOS4VJooak1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fd8yHuA%2FbtsI3dAVGrW%2FgN7oxJJSUnDNOS4VJooak1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;723&quot; height=&quot;357&quot; data-origin-width=&quot;1954&quot; data-origin-height=&quot;965&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 뷰 삭제하기 :: DROP VIEW&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;생성한 뷰를 삭제하고 싶다면 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;&lt;b&gt;DROP VIEW &lt;/b&gt;뷰이름 &lt;/span&gt;을 사용합니다.&lt;br /&gt;굳이 삭제하지 않아도 서버를 종료하면 사라지지만, 뷰를 삭제할 필요가 생길 수 있겠죠.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1792&quot; data-origin-height=&quot;374&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cDSp34/btsI2D1bbJk/J6QNzIYgsYgpWRyCK7ryQ0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cDSp34/btsI2D1bbJk/J6QNzIYgsYgpWRyCK7ryQ0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cDSp34/btsI2D1bbJk/J6QNzIYgsYgpWRyCK7ryQ0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcDSp34%2FbtsI2D1bbJk%2FJ6QNzIYgsYgpWRyCK7ryQ0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1792&quot; height=&quot;374&quot; data-origin-width=&quot;1792&quot; data-origin-height=&quot;374&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id=&quot;gtx-trans&quot; style=&quot;position: absolute; left: 305px; top: 1736.97px;&quot;&gt;
&lt;div class=&quot;gtx-trans-icon&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>ALTER VIEW</category>
      <category>CREATE VIEW</category>
      <category>DROP VIEW</category>
      <category>MySQL</category>
      <category>SQL</category>
      <category>SQL VIEW</category>
      <category>sql 뷰</category>
      <category>View</category>
      <category>뷰</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/173</guid>
      <comments>https://sy-log.tistory.com/entry/MySQL-%EB%B7%B0VIEW-%EC%83%9D%EC%84%B1-%EC%88%98%EC%A0%95-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0-CREATE-VIEW-ALTER-VIEW-DROP-VIEW#entry173comment</comments>
      <pubDate>Mon, 12 Aug 2024 20:55:28 +0900</pubDate>
    </item>
    <item>
      <title>[MySQL] 서브쿼리Subquery 활용해 데이터 조회하기</title>
      <link>https://sy-log.tistory.com/entry/SQL-%EC%84%9C%EB%B8%8C%EC%BF%BC%EB%A6%ACSubquery-%ED%99%9C%EC%9A%A9%ED%95%98%EC%97%AC-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A1%B0%ED%9A%8C%ED%95%98%EA%B8%B0</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 서브쿼리 Subquery&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;서브쿼리란, 말그대로 쿼리 안에 다시 쿼리를 사용하는 SQL문&lt;/b&gt;을 말합니다.&lt;/span&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;메인쿼리의 특정 절 안에서 괄호를 치고, 그 괄호 안에서 SELECT~ FROM~ .. 쿼리가 들어가는 형태입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이 때 &lt;b&gt;어떤 절 안에 들어가느냐&lt;/b&gt;에 따라, 아래처럼 다르게 칭합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 33.3333%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;인라인 뷰 (Inline view)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;스칼라 서브쿼리 (Scala Subquery)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;서브쿼리&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- FROM절 안에 들어가는 서브쿼리&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 가상의 테이블을 하나 만드는 효과&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- SELECT절 안에 들어가는 서브쿼리&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 연산속도가 비교적 느려 잘 사용하지 않음&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- WHERE절 안에 들어가는 서브쿼리&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; FROM 절 내 서브쿼리 :: 인라인 뷰&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;FROM절은 원래 데이터를 조회할 테이블을 선택하는 부분이니, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;FROM절 안에서 사용하는 서브쿼리는 &lt;b&gt;가상의 테이블을 하나 만들어내는 효과&lt;/b&gt;를 발휘합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;따라서, 아래 예시의 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;AS A&lt;/span&gt; 부분처럼 &lt;b&gt;테이블 이름을 지정&lt;/b&gt;해줘야 합니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래는 sales 테이블에서 회원별로 그룹핑해서 주문횟수를 조회하고, 그 횟수가 3번 이상인 데이터만 출력한 결과입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1628&quot; data-origin-height=&quot;695&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/caNQnc/btsI0dCxzU6/sEVhP2OWGCgiIkB5UicAmK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/caNQnc/btsI0dCxzU6/sEVhP2OWGCgiIkB5UicAmK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/caNQnc/btsI0dCxzU6/sEVhP2OWGCgiIkB5UicAmK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcaNQnc%2FbtsI0dCxzU6%2FsEVhP2OWGCgiIkB5UicAmK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;649&quot; height=&quot;277&quot; data-origin-width=&quot;1628&quot; data-origin-height=&quot;695&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; SELECT 절 내 서브쿼리 :: 스칼라 서브쿼리&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;스칼라란 1개의 값만 보유하는 원자량을 의미합니다.&amp;nbsp;&lt;br /&gt;마찬가지로 스칼라 서브쿼리는, &lt;b&gt;1개 행 1개 열만&lt;/b&gt; &lt;b&gt;반환&lt;/b&gt;해야 합니다. 즉 1개 값만 반환해야 합니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시에서는 &quot;평균구매개수&quot; 라는 1개 값을 반환해서 하나의 열로 붙여주었습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1676&quot; data-origin-height=&quot;632&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/x4TgO/btsIZKt2JRA/ZLXck4W4sQKFrIRyrJz1P1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/x4TgO/btsIZKt2JRA/ZLXck4W4sQKFrIRyrJz1P1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/x4TgO/btsIZKt2JRA/ZLXck4W4sQKFrIRyrJz1P1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fx4TgO%2FbtsIZKt2JRA%2FZLXck4W4sQKFrIRyrJz1P1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;682&quot; height=&quot;632&quot; data-origin-width=&quot;1676&quot; data-origin-height=&quot;632&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;스칼라 서브쿼리를 &lt;b&gt;조인(Join)처럼 사용&lt;/b&gt;할 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시에서는 sales 테이블을 전부 조회하고, &lt;br /&gt;회원번호(member_no) 기준으로 customer 테이블의 성별(gender)를 가져와서 맨 끝에 붙였습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이렇게 사용할 수는 있지만, &lt;b&gt;조인보다 처리속도가 느리기&lt;/b&gt; 때문에 일반적으로는 잘 사용하지 않습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1610&quot; data-origin-height=&quot;661&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/PcaQp/btsI0BbT7oL/Dd5ME29dG6WI1hivtzB7E1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/PcaQp/btsI0BbT7oL/Dd5ME29dG6WI1hivtzB7E1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/PcaQp/btsI0BbT7oL/Dd5ME29dG6WI1hivtzB7E1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FPcaQp%2FbtsI0BbT7oL%2FDd5ME29dG6WI1hivtzB7E1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;689&quot; height=&quot;283&quot; data-origin-width=&quot;1610&quot; data-origin-height=&quot;661&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; WHERE 절 내 서브쿼리&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;WHERE절은 테이블에서 특정 조건에 맞는 행만 필터링하는 부분입니다.&lt;br /&gt;그러니 WHERE절 내 서브쿼리로 한번 걸러낸 데이터 리스트를 들고와서, 메인쿼리 WHERE절에서 또 필터링하는 것입니다.&lt;br /&gt;따라서 WHERE절 내 서브쿼리는 &quot;중첩 서브쿼리&quot; 라고도 부릅니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;아래는 customer 테이블에서 가입연도가 2019년인 회원번호만 들고와서 (서브쿼리)&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;sales 테이블에서 해당 회원들의 총 주문횟수를 구하는 쿼리문입니다. (메인쿼리)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1710&quot; data-origin-height=&quot;593&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/uEBYU/btsI1E6wY3S/ZfSpBZ761Qb58qYAPhEEaK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/uEBYU/btsI1E6wY3S/ZfSpBZ761Qb58qYAPhEEaK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/uEBYU/btsI1E6wY3S/ZfSpBZ761Qb58qYAPhEEaK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FuEBYU%2FbtsI1E6wY3S%2FZfSpBZ761Qb58qYAPhEEaK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;693&quot; height=&quot;593&quot; data-origin-width=&quot;1710&quot; data-origin-height=&quot;593&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고2: &lt;a href=&quot;https://buly.kr/3CMGPjd&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://buly.kr/3CMGPjd&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>MySQL</category>
      <category>SQL</category>
      <category>SubQuery</category>
      <category>서브쿼리</category>
      <category>스칼라 서브쿼리</category>
      <category>인라인 뷰</category>
      <category>중첩 서브쿼리</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/172</guid>
      <comments>https://sy-log.tistory.com/entry/SQL-%EC%84%9C%EB%B8%8C%EC%BF%BC%EB%A6%ACSubquery-%ED%99%9C%EC%9A%A9%ED%95%98%EC%97%AC-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A1%B0%ED%9A%8C%ED%95%98%EA%B8%B0#entry172comment</comments>
      <pubDate>Sat, 10 Aug 2024 21:21:25 +0900</pubDate>
    </item>
    <item>
      <title>[MySQL] 조인JOIN 으로 테이블 결합하기 (INNER JOIN, LEFT JOIN, RIGHT JOIN</title>
      <link>https://sy-log.tistory.com/entry/SQL-%EC%A1%B0%EC%9D%B8JOIN-%EC%9C%BC%EB%A1%9C-%ED%85%8C%EC%9D%B4%EB%B8%94-%EA%B2%B0%ED%95%A9%ED%95%98%EA%B8%B0-INNER-JOIN-LEFT-JOIN-RIGHT-JOIN</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 조인JOIN 으로 테이블 결합하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;JOIN은 테이블 간의 관계를 이용해서, 2개 이상의 테이블을 결합&lt;/b&gt;하는 SQL 명령어입니다.&lt;/span&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블 간의 관계가 있다는 것은 곧,&lt;b&gt; 테이블 간 연결이 가능하다&lt;/b&gt;는 의미입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그리고 테이블 간 연결은, 한 테이블의 PK(기본키)가 다른 테이블의 FK(외래키)로 들어가 있어서 가능한 것입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다시 말해, 2개 이상의 테이블 간에&lt;b&gt; 공통된 값이 있다&lt;/b&gt;는 뜻입니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 내부조인 INNER JOIN&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;INNER JOIN은 두 테이블 간의 공통값이 매칭되는 데이터만 결합해서 조회해주는 조인 명령어&lt;/b&gt;입니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;따라서 양측 테이블에서 매칭되지 않는 데이터는 전부 제외됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;공통값을 찾을 열은 &lt;b&gt;ON&lt;/b&gt; 뒤에 지정합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래에선 customer의 회원번호 열과 sales의 회원번호 열이 일치하면 결합하도록 지정했습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 79.7675%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1680&quot; data-origin-height=&quot;665&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/7kq8W/btsI1ly7FBQ/fC65t6kP6yPQmbfwAN7Mxk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/7kq8W/btsI1ly7FBQ/fC65t6kP6yPQmbfwAN7Mxk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/7kq8W/btsI1ly7FBQ/fC65t6kP6yPQmbfwAN7Mxk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7kq8W%2FbtsI1ly7FBQ%2FfC65t6kP6yPQmbfwAN7Mxk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1680&quot; height=&quot;665&quot; data-origin-width=&quot;1680&quot; data-origin-height=&quot;665&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 20.2325%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;322&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Pivd6/btsIZzTwrBj/Lo4Jhk7KSvkrANKml8zaK0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Pivd6/btsIZzTwrBj/Lo4Jhk7KSvkrANKml8zaK0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Pivd6/btsIZzTwrBj/Lo4Jhk7KSvkrANKml8zaK0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FPivd6%2FbtsIZzTwrBj%2FLo4Jhk7KSvkrANKml8zaK0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;425&quot; height=&quot;322&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;322&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래는 3개 테이블을 INNER JOIN 해본 예시입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 79.7674%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;2029&quot; data-origin-height=&quot;612&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/doEiN8/btsI0Gxf1sj/PSS4lJaakDO33TXbkuJbHk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/doEiN8/btsI0Gxf1sj/PSS4lJaakDO33TXbkuJbHk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/doEiN8/btsI0Gxf1sj/PSS4lJaakDO33TXbkuJbHk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdoEiN8%2FbtsI0Gxf1sj%2FPSS4lJaakDO33TXbkuJbHk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;2029&quot; height=&quot;612&quot; data-origin-width=&quot;2029&quot; data-origin-height=&quot;612&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 20.2326%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;481&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bLRsJG/btsI1eUmzXf/P9Q4AvWRuWszwgy8PKP8pK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bLRsJG/btsI1eUmzXf/P9Q4AvWRuWszwgy8PKP8pK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bLRsJG/btsI1eUmzXf/P9Q4AvWRuWszwgy8PKP8pK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbLRsJG%2FbtsI1eUmzXf%2FP9Q4AvWRuWszwgy8PKP8pK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;425&quot; height=&quot;481&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;481&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 외부조인 OUTER JOIN &amp;mdash; &lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;LEFT JOIN &amp;amp; RIGHT JOIN&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;OUTER JOIN은 위의 INNER JOIN과 다르게, 매칭되지 않는 데이터도 포함해서 결합해줍니다.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;LEFT JOIN&lt;/b&gt;으로 결합한 결과 = INNER JOIN 결과 + 왼쪽 테이블의 모든 데이터&lt;br /&gt;따라서 오른쪽 테이블에선 매칭되는 값이 없는 경우가 생깁니다. 이 경우 NULL값으로 출력됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;RIGHT JOIN&lt;/b&gt;으로 결합한 결과 = &lt;span style=&quot;color: #000000; text-align: left;&quot;&gt;INNER JOIN 결과 + 오른쪽 테이블의 모든 데이터&lt;br /&gt;마찬가지로 왼쪽 테이블에서 매칭되는 값이 없으면, 아래와 같이 NULL값으로 출력됩니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 588px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 80.1163%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1728&quot; data-origin-height=&quot;642&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/duL5Ef/btsI07nzePt/BF2mGRq9MGi3wO5HSiPrWk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/duL5Ef/btsI07nzePt/BF2mGRq9MGi3wO5HSiPrWk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/duL5Ef/btsI07nzePt/BF2mGRq9MGi3wO5HSiPrWk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FduL5Ef%2FbtsI07nzePt%2FBF2mGRq9MGi3wO5HSiPrWk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1728&quot; height=&quot;642&quot; data-origin-width=&quot;1728&quot; data-origin-height=&quot;642&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 19.8837%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;322&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cH48B0/btsI0waCQg6/MNP6HNoKuuNUx2wAPkStFk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cH48B0/btsI0waCQg6/MNP6HNoKuuNUx2wAPkStFk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cH48B0/btsI0waCQg6/MNP6HNoKuuNUx2wAPkStFk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcH48B0%2FbtsI0waCQg6%2FMNP6HNoKuuNUx2wAPkStFk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;425&quot; height=&quot;322&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;322&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 80.1163%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1462&quot; data-origin-height=&quot;695&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bg050C/btsIZvjnCUK/8mut39wVm1x3o0sZY6z7nK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bg050C/btsIZvjnCUK/8mut39wVm1x3o0sZY6z7nK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bg050C/btsIZvjnCUK/8mut39wVm1x3o0sZY6z7nK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbg050C%2FbtsIZvjnCUK%2F8mut39wVm1x3o0sZY6z7nK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;568&quot; height=&quot;270&quot; data-origin-width=&quot;1462&quot; data-origin-height=&quot;695&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 19.8837%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;322&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/MAHJc/btsI1vat28G/G8JEx3dzjPFaUlNwT18Mk1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/MAHJc/btsI1vat28G/G8JEx3dzjPFaUlNwT18Mk1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/MAHJc/btsI1vat28G/G8JEx3dzjPFaUlNwT18Mk1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FMAHJc%2FbtsI1vat28G%2FG8JEx3dzjPFaUlNwT18Mk1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;425&quot; height=&quot;322&quot; data-origin-width=&quot;425&quot; data-origin-height=&quot;322&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;참고1:&amp;nbsp;boostcourse&amp;nbsp;강좌&amp;nbsp;(기초&amp;nbsp;데이터&amp;nbsp;분석을&amp;nbsp;위한&amp;nbsp;핵심&amp;nbsp;SQL)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;참고2:&lt;/span&gt; &lt;a href=&quot;https://buly.kr/EI1ztrP&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://buly.kr/EI1ztrP&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>inner join</category>
      <category>Join</category>
      <category>LEFT JOIN</category>
      <category>MySQL</category>
      <category>outer join</category>
      <category>RIGHT JOIN</category>
      <category>SQL</category>
      <category>내부조인</category>
      <category>외부조인</category>
      <category>조인</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/171</guid>
      <comments>https://sy-log.tistory.com/entry/SQL-%EC%A1%B0%EC%9D%B8JOIN-%EC%9C%BC%EB%A1%9C-%ED%85%8C%EC%9D%B4%EB%B8%94-%EA%B2%B0%ED%95%A9%ED%95%98%EA%B8%B0-INNER-JOIN-LEFT-JOIN-RIGHT-JOIN#entry171comment</comments>
      <pubDate>Sat, 10 Aug 2024 01:07:54 +0900</pubDate>
    </item>
    <item>
      <title>[MySQL] SELECT문으로 데이터 조회하기 (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY)</title>
      <link>https://sy-log.tistory.com/entry/SQL-SELECT%EB%AC%B8%EC%9C%BC%EB%A1%9C-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A1%B0%ED%9A%8C%ED%95%98%EA%B8%B0-FROM-WHERE-GROUP-BY-HAVING-SELECT-ORDER-BY</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; SELECT문으로 데이터 조회하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT는 필요한 데이터를 조회할 수 있게 해주는 SQL 명령어입니다. &lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;SELECT는 여러가지 절들과 함께 사용될 수 있는데, 아래와 같이 순서를 지켜줘야 합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;SELECT &amp;rarr; FROM &lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&amp;rarr;&lt;/span&gt;&lt;/b&gt; WHERE &lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&amp;rarr;&lt;/span&gt;&lt;/b&gt; GROUP BY &lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&amp;rarr;&lt;/span&gt;&lt;/b&gt; HAVING &lt;b&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&amp;rarr;&lt;/span&gt;&lt;/b&gt; ORDER BY&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;SQL문을 통해 &lt;b&gt;데이터를 조회하는 순서&lt;/b&gt;를 살펴보면 아래와 같습니다.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 85.9303%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 15.5759%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;FROM&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.8282%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터를 조회할 &lt;b&gt;테이블을 선택&lt;/b&gt;함&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 15.5759%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;WHERE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.8282%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;선택한 테이블을 특정 조건으로 필터링함 &amp;rarr; &lt;b&gt;특정 조건에 맞는 행만&lt;/b&gt; 선택함&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 15.5759%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;GROUP BY&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.8282%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블의 특정 열의 내용에 따라 그룹핑함 &lt;span style=&quot;background-color: #f8fbfb; text-align: start;&quot;&gt;&amp;rarr;&lt;/span&gt; &lt;b&gt;그룹별 데이터를 집계해서 새로운 테이블을 생성&lt;/b&gt;함&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 15.5759%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;HAVING&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.8282%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;그룹핑&lt;/b&gt;된 새로운 테이블을 특정 조건으로 &lt;b&gt;필터링&lt;/b&gt;함&lt;span style=&quot;color: #9d9d9d;&quot;&gt; (GROUP BY 아래에서 사용되어야 함)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 15.5759%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.8282%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터를 조회할 &lt;b&gt;열을 선택&lt;/b&gt;함&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 15.5759%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;ORDER BY&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.8282%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;열을 오름차순(ASC) 혹은 내림차순(DESC)으로 &lt;b&gt;정렬&lt;/b&gt;함 &lt;span style=&quot;color: #9d9d9d;&quot;&gt;(맨 마지막에서 사용되어야 함)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; SELECT문으로 데이터 조회하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;회원정보 테이블에서 여성회원의 정보만 조회하는 SQL문을 작성해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;SELECT *&lt;/b&gt; 은 모든 열을 조회한다는 의미입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 46px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 19px;&quot;&gt;
&lt;td style=&quot;width: 51.7054%; height: 46px; text-align: center;&quot; rowspan=&quot;3&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;702&quot; data-origin-height=&quot;377&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bAx64j/btsIZrg2S6v/GmQS0ZizpeMK67odNUqsp0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bAx64j/btsIZrg2S6v/GmQS0ZizpeMK67odNUqsp0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bAx64j/btsIZrg2S6v/GmQS0ZizpeMK67odNUqsp0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbAx64j%2FbtsIZrg2S6v%2FGmQS0ZizpeMK67odNUqsp0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;352&quot; height=&quot;189&quot; data-origin-width=&quot;702&quot; data-origin-height=&quot;377&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 12.5193%; height: 19px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;FROM&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.7752%; height: 19px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; customer(회원정보) 테이블에서 &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 12.5193%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;WHERE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.7752%; height: 17px;&quot;&gt;&lt;span style=&quot;background-color: #f8fbfb; color: #000000; text-align: start; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; gender(성별) = 'F'(여성) 인 행만 필터링해서 &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 10px;&quot;&gt;
&lt;td style=&quot;width: 12.5193%; height: 10px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.7752%; height: 10px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;모든 열을 조회한다&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; GROUP BY 와 집계함수로 데이터 조회하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;회원정보 테이블에서 주거지역별로 여성회원의 수를 집계해서 조회해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래의 address와 같이, &lt;b&gt;GROUP BY에 넣은 열을 SELECT에도 넣어줘야&lt;/b&gt; 원하는 분석결과를 보기좋게 출력할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100.116%; height: 167px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 51.7054%; text-align: center;&quot; rowspan=&quot;4&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;791&quot; data-origin-height=&quot;416&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/biNapo/btsI0KTH7Si/JyDSvlk6akDqgsl3RNNbPk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/biNapo/btsI0KTH7Si/JyDSvlk6akDqgsl3RNNbPk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/biNapo/btsI0KTH7Si/JyDSvlk6akDqgsl3RNNbPk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbiNapo%2FbtsI0KTH7Si%2FJyDSvlk6akDqgsl3RNNbPk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;367&quot; height=&quot;193&quot; data-origin-width=&quot;791&quot; data-origin-height=&quot;416&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 13.1007%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;FROM&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.1938%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;customer(회원정보) 테이블에서&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.1007%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;WHERE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.1938%;&quot;&gt;&lt;span style=&quot;background-color: #f8fbfb; color: #000000; text-align: start; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; gender(성별) = 'F'(여성) 인 행만 필터링하고&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.1007%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;GROUP BY&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.1938%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; address(주거지역) 별로 그룹핑해서&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.1007%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.1938%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;address(주거지역), 회원수 2개열을 조회한다&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;회원정보 테이블에서 주거지역별로 여성회원 수가 100명 넘는 경우를 조회해서, 오름차순으로 정렬해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;그룹핑해서 만든 새로운 테이블에서 필터링&lt;/b&gt;을 하려면, 아래와 같이 &lt;b&gt;HAVING절&lt;/b&gt;을 사용해야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 150px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 51.5116%; text-align: center; height: 150px;&quot; rowspan=&quot;6&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;804&quot; data-origin-height=&quot;521&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dNd39U/btsIZoq3OPL/QXgH0LXC8i0Oqe4Vj9bp00/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dNd39U/btsIZoq3OPL/QXgH0LXC8i0Oqe4Vj9bp00/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dNd39U/btsIZoq3OPL/QXgH0LXC8i0Oqe4Vj9bp00/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdNd39U%2FbtsIZoq3OPL%2FQXgH0LXC8i0Oqe4Vj9bp00%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;396&quot; height=&quot;257&quot; data-origin-width=&quot;804&quot; data-origin-height=&quot;521&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 12.8488%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;FROM&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.6396%; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; customer(회원정보) 테이블에서 &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 12.8488%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;WHERE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.6396%; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;gender(성별) = 'F'(여성) 인 행만 필터링해서&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 12.8488%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;GROUP BY&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.6396%; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;address(주거지역) 별로 그룹핑하고&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 12.8488%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;HAVING&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.6396%; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;count수가 100이 넘는 경우만 필터링해서&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 12.8488%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.6396%; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;address(주거지역), 회원수 2개 열을 조회한다&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 12.8488%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;ORDER BY&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.6396%; height: 25px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;이 결과를 회원수 기준 오름차순으로 정렬한다&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;div id=&quot;gtx-trans&quot; style=&quot;position: absolute; left: 497px; top: 1041.46px;&quot;&gt;
&lt;div class=&quot;gtx-trans-icon&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>From</category>
      <category>group by</category>
      <category>HAVING</category>
      <category>MySQL</category>
      <category>order by</category>
      <category>select</category>
      <category>SQL</category>
      <category>where</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/170</guid>
      <comments>https://sy-log.tistory.com/entry/SQL-SELECT%EB%AC%B8%EC%9C%BC%EB%A1%9C-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A1%B0%ED%9A%8C%ED%95%98%EA%B8%B0-FROM-WHERE-GROUP-BY-HAVING-SELECT-ORDER-BY#entry170comment</comments>
      <pubDate>Fri, 9 Aug 2024 23:31:57 +0900</pubDate>
    </item>
    <item>
      <title>[SQL TCL] 트랜잭션Transaction, 실행Commit, 취소Rollback, 임시저장Savepoint</title>
      <link>https://sy-log.tistory.com/entry/SQL-TCL-%ED%8A%B8%EB%9E%9C%EC%9E%AD%EC%85%98Transaction-%EC%8B%A4%ED%96%89Commit-%EC%B7%A8%EC%86%8CRollback-%EC%9E%84%EC%8B%9C%EC%A0%80%EC%9E%A5Savepoint</link>
      <description>&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size18&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; TCL (Transaction Control Language, 트랜잭션 제어어)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션 제어어는 &lt;b&gt;DML 명령어를 실행(Commit), 취소(Rollback), 임시저장(Savepoint)할 때 사용하는 명령어&lt;/b&gt;입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;여기서&lt;b&gt; 트랜잭션(Transaction)이란, SQL 명령어들로 이루어진 논리적인 작업단위&lt;/b&gt;입니다.&lt;br /&gt;이때 명령어들은 위에서 언급했듯이 INSERT, SELECT, UPDATE, DELETE와 같은 DML 명령어들로 이루어져 있습니다.&lt;br /&gt;또한 트랜잭션은 더 분할할 수 없는 최소의 작업단위입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 33.3333%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;실행&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;취소&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;임시저장&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center; width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&lt;b&gt;COMMIT&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&lt;b&gt;ROLLBACK&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&lt;b&gt;SAVEPOINT&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 모든 작업을 최종 실행함&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 변경된 데이터를 테이블에 영구 반영함&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 모든 작업을 되돌림=취소함&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 따라서 데이터 변경 이전 상태로 복구됨&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.3333%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- ROLLBACK 지정점을 정함&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 현시점에서 임시저장점까지&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&amp;nbsp; 트랜잭션 일부만 취소할 수 있게 해줌&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 트랜잭션 취소 :: ROLLBACK&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션의 시작은 아래와 같이&lt;b&gt; BEGIN&lt;/b&gt; 명령어로 선언합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션을 취소 = BEGIN 아래에 포함된 모든 작업/명령어들을 &lt;b&gt;취소하고 되돌리려면&lt;/b&gt;, &lt;b&gt;ROLLBACK&lt;/b&gt; 명령어를 사용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 35.3488%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션 시작하고 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블에 데이터 추가&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 64.6512%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1002&quot; data-origin-height=&quot;458&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/9NenI/btsIWfnrBtk/ibx4VL75n7Oc7DTIsWIk80/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/9NenI/btsIWfnrBtk/ibx4VL75n7Oc7DTIsWIk80/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/9NenI/btsIWfnrBtk/ibx4VL75n7Oc7DTIsWIk80/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F9NenI%2FbtsIWfnrBtk%2Fibx4VL75n7Oc7DTIsWIk80%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1002&quot; height=&quot;458&quot; data-origin-width=&quot;1002&quot; data-origin-height=&quot;458&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 35.3488%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션 취소(ROLLBACK) 해서&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;추가했던 데이터 제거됨&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 64.6512%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;991&quot; data-origin-height=&quot;273&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/shXx0/btsIX45QQoS/5fkiLlBOMkAU5GsivkdaQk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/shXx0/btsIX45QQoS/5fkiLlBOMkAU5GsivkdaQk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/shXx0/btsIX45QQoS/5fkiLlBOMkAU5GsivkdaQk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FshXx0%2FbtsIX45QQoS%2F5fkiLlBOMkAU5GsivkdaQk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;991&quot; height=&quot;273&quot; data-origin-width=&quot;991&quot; data-origin-height=&quot;273&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 트랜잭션 실행 :: COMMIT&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션을 실행 = BEGIN 아래에 포함된 모든 작업/명령어들을 &lt;b&gt;실행하고 결과를 반영&lt;/b&gt;하려면, &lt;b&gt;COMMIT&lt;/b&gt; 명령어를 사용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 35.9302%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션 시작하고&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블에 데이터 추가&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 64.0698%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1002&quot; data-origin-height=&quot;456&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/QG4xb/btsIWXzMiM3/6iDimd0sYhRQifMMJfSCS0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/QG4xb/btsIWXzMiM3/6iDimd0sYhRQifMMJfSCS0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/QG4xb/btsIWXzMiM3/6iDimd0sYhRQifMMJfSCS0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FQG4xb%2FbtsIWXzMiM3%2F6iDimd0sYhRQifMMJfSCS0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1002&quot; height=&quot;456&quot; data-origin-width=&quot;1002&quot; data-origin-height=&quot;456&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 35.9302%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션 실행(COMMIT) 해서&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 추가 반영됨&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 64.0698%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;992&quot; data-origin-height=&quot;296&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cbL7kn/btsIWQAKKER/7KyB2uIei5KPAvgQahry0k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cbL7kn/btsIWQAKKER/7KyB2uIei5KPAvgQahry0k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cbL7kn/btsIWQAKKER/7KyB2uIei5KPAvgQahry0k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcbL7kn%2FbtsIWQAKKER%2F7KyB2uIei5KPAvgQahry0k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;992&quot; height=&quot;296&quot; data-origin-width=&quot;992&quot; data-origin-height=&quot;296&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 임시저장 :: SAVEPOINT&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SAVEPOINT 명령을 사용하여, &lt;b&gt;트랜잭션 중간중간에 임시저장점&lt;/b&gt;을 만들 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;임시저장점을 만들면 트랜잭션 전체를 취소(ROLLBACK)하지 않고,&lt;b&gt;현 시점에서 임시저장점까지의 일부만 취소&lt;/b&gt;할 수 있습니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만, 임시저장점이 여러개인 경우!&lt;br /&gt;한번 과거의 저장점으로 취소(ROLLBACK)하고 난 뒤엔, 그 이후 시점의 저장점으로 취소할 수 없게 됩니다.&lt;br /&gt;다시 말해서, 특정 저장점까지 취소하면 그 이후의 저장점들은 무효가 된다는 점.. 유의해야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시를 보면, S2로 한번 롤백하고 나니 S3로 롤백할 수 없게 되었습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 37.4419%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;트랜잭션 시작&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&amp;rarr; 데이터 삽입하고 임시저장점 S1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;rarr; 데이터 수정하고 S2&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;rarr; 데이터 삭제하고 S3&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 62.5581%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1001&quot; data-origin-height=&quot;905&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/kF27K/btsIYZQbFgA/Wu0jWnZnkC7oA33ubZ9XBK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/kF27K/btsIYZQbFgA/Wu0jWnZnkC7oA33ubZ9XBK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/kF27K/btsIYZQbFgA/Wu0jWnZnkC7oA33ubZ9XBK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FkF27K%2FbtsIYZQbFgA%2FWu0jWnZnkC7oA33ubZ9XBK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1001&quot; height=&quot;905&quot; data-origin-width=&quot;1001&quot; data-origin-height=&quot;905&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 37.4419%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;S2 지점으로 롤백&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 62.5581%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;999&quot; data-origin-height=&quot;292&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/uI6oe/btsIXIIIVTd/3FsktNKoDjKkJTKv0jFNpk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/uI6oe/btsIXIIIVTd/3FsktNKoDjKkJTKv0jFNpk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/uI6oe/btsIXIIIVTd/3FsktNKoDjKkJTKv0jFNpk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FuI6oe%2FbtsIXIIIVTd%2F3FsktNKoDjKkJTKv0jFNpk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;999&quot; height=&quot;292&quot; data-origin-width=&quot;999&quot; data-origin-height=&quot;292&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 37.4419%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이후 S3 지점은 무효가 되어&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;롤백 불가능&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 62.5581%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;925&quot; data-origin-height=&quot;233&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vLGZj/btsIYXx4nL9/E22G12twsFjxOoujT7GesK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vLGZj/btsIYXx4nL9/E22G12twsFjxOoujT7GesK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vLGZj/btsIYXx4nL9/E22G12twsFjxOoujT7GesK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FvLGZj%2FbtsIYXx4nL9%2FE22G12twsFjxOoujT7GesK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;925&quot; height=&quot;233&quot; data-origin-width=&quot;925&quot; data-origin-height=&quot;233&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 37.4419%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;S1 지점은 S2 이전이므로&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;롤백 가능&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 62.5581%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1004&quot; data-origin-height=&quot;486&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/pepRz/btsIX3eQkTD/oEoB2EhE1l2weOzTBiK441/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/pepRz/btsIX3eQkTD/oEoB2EhE1l2weOzTBiK441/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/pepRz/btsIX3eQkTD/oEoB2EhE1l2weOzTBiK441/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FpepRz%2FbtsIX3eQkTD%2FoEoB2EhE1l2weOzTBiK441%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1004&quot; height=&quot;486&quot; data-origin-width=&quot;1004&quot; data-origin-height=&quot;486&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고2: &lt;a href=&quot;https://buly.kr/HSVcpdQ&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://buly.kr/HSVcpdQ&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>commit</category>
      <category>MySQL</category>
      <category>rollback</category>
      <category>savepoint</category>
      <category>SQL</category>
      <category>tcl</category>
      <category>Transaction</category>
      <category>롤백</category>
      <category>트랜잭션</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/169</guid>
      <comments>https://sy-log.tistory.com/entry/SQL-TCL-%ED%8A%B8%EB%9E%9C%EC%9E%AD%EC%85%98Transaction-%EC%8B%A4%ED%96%89Commit-%EC%B7%A8%EC%86%8CRollback-%EC%9E%84%EC%8B%9C%EC%A0%80%EC%9E%A5Savepoint#entry169comment</comments>
      <pubDate>Thu, 8 Aug 2024 00:49:41 +0900</pubDate>
    </item>
    <item>
      <title>[SQL DML] SQL 데이터 삽입INSERT, 조회SELECT, 수정UPDATE, 삭제DELETE</title>
      <link>https://sy-log.tistory.com/entry/SQL-DML-%ED%85%8C%EC%9D%B4%EB%B8%94%EC%97%90-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%82%BD%EC%9E%85-%EC%A1%B0%ED%9A%8C-%EC%88%98%EC%A0%95-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; DML (Data Manipulation Language, 데이터 조작어)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;DML 은 테이블에서 데이터를 삽입, 조회, 수정, 삭제하기 위한 SQL 명령어&lt;/b&gt;입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;여기서 &lt;b&gt;WHERE절로 조건문&lt;/b&gt;을 생성해서 원하는 조건을 검색한 다음, 데이터를 조작할 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.8837%; height: 298px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style5&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.2172%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;DML&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 43.2169%; text-align: center;&quot; colspan=&quot;2&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SQL 문법 예시&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.2172%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;새로운 데이터 &lt;b&gt;삽입&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 8.37209%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #f8fbfb; text-align: start;&quot;&gt;INSERT&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 34.8448%;&quot;&gt;&lt;span style=&quot;background-color: #f8fbfb; color: #000000; text-align: start; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; INSERT INTO 테이블이름 VALUES (추가할 데이터 내용);&lt;br /&gt;INSERT INTO 테이블이름 (열1, 열2, ...) VALUES (내용1, 내용2, ...);&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.2172%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 데이터 &lt;b&gt;조회&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 8.37209%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 34.8448%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT * FROM 테이블이름;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SELECT (칼럼1, 칼럼2, ...) FROM 테이블이름;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.2172%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 데이터 &lt;b&gt;수정&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 8.37209%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;UPDATE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 34.8448%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;UPDATE 테이블이름 SET 수정할 내용;&lt;br /&gt;&lt;span style=&quot;background-color: #f8fbfb; text-align: start;&quot;&gt;UPDATE 테이블이름 SET 수정할 내용 WHERE 원하는 조건;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 13.2172%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 데이터 &lt;b&gt;삭제&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 8.37209%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;DELETE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 34.8448%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;DELETE FROM 테이블이름;&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;DELETE FROM 테이블이름 WHERE 원하는 조건;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 새로운 데이터 삽입 :: INSERT&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블에 새로운 데이터를 삽입하려면, 아래와 같이 &lt;b&gt;INSERT문&lt;/b&gt;을 사용해야 합니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&quot;회원정보&quot; 테이블을 만들어서 데이터 5행을 추가했습니다.&lt;br /&gt;마지막 행처럼 원하는 칼럼들만 지정해서 데이터를 추가할 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이 때 제약조건를 위반하거나, 데이터타입이 맞지 않게 추가하면 에러가 뜨고 추가되지 않습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1108&quot; data-origin-height=&quot;966&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bPRunu/btsIWcKWfZm/eByHJtElwOuZBrk1vZ3Ulk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bPRunu/btsIWcKWfZm/eByHJtElwOuZBrk1vZ3Ulk/img.png&quot; data-alt=&quot;(MySQL) 데이터 삽입 예시&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bPRunu/btsIWcKWfZm/eByHJtElwOuZBrk1vZ3Ulk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbPRunu%2FbtsIWcKWfZm%2FeByHJtElwOuZBrk1vZ3Ulk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;674&quot; height=&quot;588&quot; data-origin-width=&quot;1108&quot; data-origin-height=&quot;966&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;(MySQL) 데이터 삽입 예시&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣ 기존 데이터 조회 :: SELECT&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블에 있는 데이터를 조회하려면, &lt;b&gt;SELECT문&lt;/b&gt;을 사용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정 열만 조회하려면 열 이름을 지정하고, &lt;b&gt;특정 행&lt;/b&gt;만 조회하려면 &lt;b&gt;WHERE 절&lt;/b&gt;로 조건을 지정해주면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시처럼 특정 열을 기준으로 &lt;b&gt;정렬&lt;/b&gt;해서 조회할 수도 있습니다. 오름차순은 &lt;b&gt;ASC&lt;/b&gt;, 내림차순은 &lt;b&gt;DESC&lt;/b&gt; 로 지정합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 1127px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;모든 데이터 조회&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 18px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;867&quot; data-origin-height=&quot;408&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Dq2OM/btsIWwCsFL1/mBflRUAuO5MJz4VDbM07oK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Dq2OM/btsIWwCsFL1/mBflRUAuO5MJz4VDbM07oK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Dq2OM/btsIWwCsFL1/mBflRUAuO5MJz4VDbM07oK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FDq2OM%2FbtsIWwCsFL1%2FmBflRUAuO5MJz4VDbM07oK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;548&quot; height=&quot;408&quot; data-origin-width=&quot;867&quot; data-origin-height=&quot;408&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정한 열만 조회&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 18px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;867&quot; data-origin-height=&quot;495&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bouzRf/btsIYvhGMbY/ecuc40fSteEpzO5fvRKJR0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bouzRf/btsIYvhGMbY/ecuc40fSteEpzO5fvRKJR0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bouzRf/btsIYvhGMbY/ecuc40fSteEpzO5fvRKJR0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbouzRf%2FbtsIYvhGMbY%2Fecuc40fSteEpzO5fvRKJR0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;555&quot; height=&quot;495&quot; data-origin-width=&quot;867&quot; data-origin-height=&quot;495&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;WHERE 절을 추가해&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정 조건에 맞는 행만 출력&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 17px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;868&quot; data-origin-height=&quot;286&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sALRt/btsIXviuV2r/I7akS8abywAfOHYp4VXjOk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sALRt/btsIXviuV2r/I7akS8abywAfOHYp4VXjOk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sALRt/btsIXviuV2r/I7akS8abywAfOHYp4VXjOk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsALRt%2FbtsIXviuV2r%2FI7akS8abywAfOHYp4VXjOk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;577&quot; height=&quot;286&quot; data-origin-width=&quot;868&quot; data-origin-height=&quot;286&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 17px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ORDER BY 를 사용해서&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정 열 기준으로 정렬&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 17px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;866&quot; data-origin-height=&quot;369&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bQbtXx/btsIWeveXHn/BxFpVzRQ6Uyfg2crdhvNc1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bQbtXx/btsIWeveXHn/BxFpVzRQ6Uyfg2crdhvNc1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bQbtXx/btsIWeveXHn/BxFpVzRQ6Uyfg2crdhvNc1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbQbtXx%2FbtsIWeveXHn%2FBxFpVzRQ6Uyfg2crdhvNc1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;566&quot; height=&quot;241&quot; data-origin-width=&quot;866&quot; data-origin-height=&quot;369&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣ 기존 데이터 수정 :: UPDATE&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블에 있던 데이터를 수정 및 변경할 때는 &lt;b&gt;UPDATE문&lt;/b&gt;을 사용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 60px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 42px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 42px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;모든 데이터 수정&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 42px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;870&quot; data-origin-height=&quot;450&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Q8bTh/btsIYCAUP2t/4evADJkcSqNxnpBgx8wrZk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Q8bTh/btsIYCAUP2t/4evADJkcSqNxnpBgx8wrZk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Q8bTh/btsIYCAUP2t/4evADJkcSqNxnpBgx8wrZk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FQ8bTh%2FbtsIYCAUP2t%2F4evADJkcSqNxnpBgx8wrZk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;540&quot; height=&quot;279&quot; data-origin-width=&quot;870&quot; data-origin-height=&quot;450&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; WHERE 절을 추가해&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정 조건에 맞는 행만 출력 &lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 18px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;866&quot; data-origin-height=&quot;409&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/JnFvs/btsIXYxVyrj/Sjg3RNdvDXmTykZo7F08WK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/JnFvs/btsIXYxVyrj/Sjg3RNdvDXmTykZo7F08WK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/JnFvs/btsIXYxVyrj/Sjg3RNdvDXmTykZo7F08WK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJnFvs%2FbtsIXYxVyrj%2FSjg3RNdvDXmTykZo7F08WK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;534&quot; height=&quot;252&quot; data-origin-width=&quot;866&quot; data-origin-height=&quot;409&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣ 기존 데이터 삭제 :: DELETE&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 데이터를 삭제하려면 &lt;b&gt;DELETE문&lt;/b&gt;을 사용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 DELETE문은 &quot;삭제 여부&quot;만 표시할 뿐, 용량은 초기화하지 않으므로 테이블 용량(크기) 또한 그대로입니다.&lt;br /&gt;데이터를 삭제하고 용량까지 줄이고 싶다면, &lt;b&gt;TRUNCATE문&lt;/b&gt;을 사용해서 테이블 공간 자체를 초기화해야 합니다.&lt;br /&gt;TRUNCATE문은 데이터를 지우고 테이블의 구조는 남겨놓습니다. 테이블 구조까지 싹다 없애버리는 DROP과의 차이점입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 60px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 42px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 42px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;WHERE 절을 추가해&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정 조건에 맞는 행만 삭제&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 42px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;865&quot; data-origin-height=&quot;418&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/KEiKN/btsIWymMUxs/chH1qdrtWaLZpmN7SKejnk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/KEiKN/btsIWymMUxs/chH1qdrtWaLZpmN7SKejnk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/KEiKN/btsIWymMUxs/chH1qdrtWaLZpmN7SKejnk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FKEiKN%2FbtsIWymMUxs%2FchH1qdrtWaLZpmN7SKejnk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;532&quot; height=&quot;257&quot; data-origin-width=&quot;865&quot; data-origin-height=&quot;418&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.4495%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;모든 데이터 삭제&lt;br /&gt;(DELETE)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;866&quot; data-origin-height=&quot;280&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sIMsm/btsIYsL4jdo/rudNeW195ajXkCdz3jK0kK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sIMsm/btsIYsL4jdo/rudNeW195ajXkCdz3jK0kK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sIMsm/btsIYsL4jdo/rudNeW195ajXkCdz3jK0kK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsIMsm%2FbtsIYsL4jdo%2FrudNeW195ajXkCdz3jK0kK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;536&quot; height=&quot;173&quot; data-origin-width=&quot;866&quot; data-origin-height=&quot;280&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 23.4495%; height: 18px; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: center;&quot;&gt;모든 데이터 삭제&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: center;&quot;&gt;(TRUNCATE)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%; height: 18px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;864&quot; data-origin-height=&quot;270&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/SUYYi/btsIXGEahdZ/ocbp8OGS9eXwkFI2oNXf20/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/SUYYi/btsIXGEahdZ/ocbp8OGS9eXwkFI2oNXf20/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/SUYYi/btsIXGEahdZ/ocbp8OGS9eXwkFI2oNXf20/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FSUYYi%2FbtsIXGEahdZ%2Focbp8OGS9eXwkFI2oNXf20%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;531&quot; height=&quot;166&quot; data-origin-width=&quot;864&quot; data-origin-height=&quot;270&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.4495%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: center;&quot;&gt;참고:&lt;br /&gt;테이블 자체를 삭제&lt;br /&gt;(DROP)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 58.7985%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;925&quot; data-origin-height=&quot;317&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bUVhdR/btsIWij5bk7/wOD5irkWgJHZWWrLyeiZTK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bUVhdR/btsIWij5bk7/wOD5irkWgJHZWWrLyeiZTK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bUVhdR/btsIWij5bk7/wOD5irkWgJHZWWrLyeiZTK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbUVhdR%2FbtsIWij5bk7%2FwOD5irkWgJHZWWrLyeiZTK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;525&quot; height=&quot;180&quot; data-origin-width=&quot;925&quot; data-origin-height=&quot;317&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고2: &lt;a href=&quot;https://buly.kr/7m9wrRr&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://buly.kr/7m9wrRr&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>Delete</category>
      <category>dml</category>
      <category>insert</category>
      <category>MySQL</category>
      <category>select</category>
      <category>SQL</category>
      <category>sql 테이블</category>
      <category>Truncate</category>
      <category>Update</category>
      <category>테이블 조작</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/168</guid>
      <comments>https://sy-log.tistory.com/entry/SQL-DML-%ED%85%8C%EC%9D%B4%EB%B8%94%EC%97%90-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%82%BD%EC%9E%85-%EC%A1%B0%ED%9A%8C-%EC%88%98%EC%A0%95-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0#entry168comment</comments>
      <pubDate>Wed, 7 Aug 2024 23:23:49 +0900</pubDate>
    </item>
    <item>
      <title>[SQL DDL] SQL 테이블 생성CREATE, 수정ALTER, 삭제DROP</title>
      <link>https://sy-log.tistory.com/entry/SQL-DDL-SQL-%ED%85%8C%EC%9D%B4%EB%B8%94-%EC%83%9D%EC%84%B1-%EC%88%98%EC%A0%95-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0</link>
      <description>&lt;p style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; DDL (Data Definition Language, 데이터 정의어)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;관계형 데이터베이스(RDB; Relation Database)는 릴레이션(Relation)에 데이터를 저장, 관리합니다.&lt;br /&gt;릴레이션은 데이터베이스 관리시스템(DBMS)에서 &lt;b&gt;테이블(Table)&lt;/b&gt;로 생성되며, &lt;br /&gt;이 때 테이블을 생성, 변경, 삭제할 때 사용하는 명령어를 통틀어 DDL 이라고 부릅니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다시 말해, &lt;b&gt;DDL은 RDB의 구조를 정의하는 명령어 = 데이터를 저장하는 &lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;테이블을 생성, 변경, 삭제&lt;/span&gt;하기 위한 명령어&lt;/b&gt; 입니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예를 들면, 새로운 테이블 생성, 열 추가, 열 데이터타입 변경, 열 이름 변경, 테이블 이름 변경, 테이블 삭제 등이 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 88px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;width: 33.9535%; text-align: center; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;테이블 생성&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 32.7907%; text-align: center; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;테이블 변경&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.2558%; text-align: center; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;테이블 삭제&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;width: 33.9535%; text-align: center; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt;&lt;b&gt;CREATE TABLE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 32.7907%; text-align: center; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt;&lt;b&gt;ALTER TABLE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.2558%; text-align: center; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt;&lt;b&gt;DROP TABLE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 44px;&quot;&gt;
&lt;td style=&quot;width: 33.9535%; height: 44px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 새로운 테이블 생성&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 기본키(PK), 외래키(FK), 제약사항 설정&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 32.7907%; height: 44px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 열 추가, 변경, 삭제&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 이름 변경 등&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 33.2558%; height: 44px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 테이블 삭제&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 데이터 구조, 저장된 데이터&amp;nbsp;모두 삭제&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 테이블 생성 :: CREATE TABLE&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&lt;b&gt;CREATE TABLE&lt;/b&gt; &lt;/span&gt;명령어를 사용하여 테이블을 생성할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;테이블을 생성할 때, 각각의 열은 반드시 1가지의 &lt;b&gt;데이터타입&lt;/b&gt;으로 정의되어야 합니다.&lt;br /&gt;데이터타입은 크게 숫자형, 문자형, 날짜형으로 지정할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시에서 회원번호는 정수, 회원이름은 가변길이 문자형, 가입날짜는 날짜형, 문자수신동의는 논리형으로 지정했습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 33.3334%; text-align: center;&quot; colspan=&quot;2&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt;&lt;b&gt;숫자형&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 35.8915%; text-align: center;&quot; colspan=&quot;2&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt;&lt;b&gt;문자형&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 30.7753%; text-align: center;&quot; colspan=&quot;2&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt;&lt;b&gt;날짜형&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 11.5504%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;BIT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 21.783%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;논리형 (0 or 1 or NULL)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 13.7597%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;CHAR(n)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 22.1318%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;고정길이 문자형&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.8295%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;DATETIME&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 17.9458%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;년-월-일 시:분:초&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 11.5504%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;INT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 21.783%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;정수 (4byte)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 13.7597%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;NCHAR(n)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 22.1318%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;유니코드 고정길이 문자형&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.8295%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;DATE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 17.9458%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;년-월-일&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 11.5504%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;BIGINT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 21.783%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;정수 (8byte)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 13.7597%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;VARCHAR(n)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 22.1318%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;가변길이 문자형&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.8295%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;TIME&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 17.9458%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;시:분:초&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 11.5504%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;FLOAT&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 21.783%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;실수 (4byte)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 13.7597%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;NVARCHAR(n)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 22.1318%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;유니코드 가변길이 문자형&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.8295%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 17.9458%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 11.5504%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;DOUBLE&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 21.783%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;실수 (8byte)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 13.7597%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 22.1318%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 12.8295%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style=&quot;width: 17.9458%;&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;또한 각 열마다 &lt;b&gt;제한조건&lt;/b&gt;을 정의할 수 있습니다.&lt;br /&gt;아래 예시에서 회원번호 열은 기본키(PK)로 지정했으며, 가입날짜 열은 Null값을 허용하지 않도록 제약조건을 걸었습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기본키(PK)는 엔터티를 대표할 수 있는 주식별자를 말합니다. PK로 지정된 열에는 중복값이나 Null값이 있으면 안됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;857&quot; data-origin-height=&quot;861&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/mQhrw/btsIYCgyf8K/qHfDYhzSpEDfOz3u72AXTK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/mQhrw/btsIYCgyf8K/qHfDYhzSpEDfOz3u72AXTK/img.png&quot; data-alt=&quot;(MySQL) 테이블 생성 예시&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/mQhrw/btsIYCgyf8K/qHfDYhzSpEDfOz3u72AXTK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmQhrw%2FbtsIYCgyf8K%2FqHfDYhzSpEDfOz3u72AXTK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;560&quot; height=&quot;563&quot; data-origin-width=&quot;857&quot; data-origin-height=&quot;861&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;(MySQL) 테이블 생성 예시&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;&gt;&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 테이블 변경/수정 :: ALTER TABLE&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&lt;b&gt;ALTER TABLE&lt;/b&gt;&lt;/span&gt; 명령어를 사용하여 테이블을 변경 및 수정할 수 있습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;새로운 열 추가&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;열 데이터타입 변경&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;열 이름 변경&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;테이블 이름 변경&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt; &lt;b&gt;ADD&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt; &lt;b&gt;MODIFY&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt; &lt;b&gt;CHANGE&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #b6e1f2; color: #000000;&quot;&gt; &lt;b&gt;RENAME&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;새로운 열을 추가하려면, 아래와 같이 &lt;b&gt;ADD&lt;/b&gt; 를 활용합니다.&lt;br /&gt;테이블을 확인하니 새로 추가한 열 &quot;성&quot;이 맨 끝에 추가된 모습을 확인할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;867&quot; data-origin-height=&quot;326&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b7hVNa/btsIW6XAGCH/1GgkjpqbmjZKlZFzRdkGl0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b7hVNa/btsIW6XAGCH/1GgkjpqbmjZKlZFzRdkGl0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b7hVNa/btsIW6XAGCH/1GgkjpqbmjZKlZFzRdkGl0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb7hVNa%2FbtsIW6XAGCH%2F1GgkjpqbmjZKlZFzRdkGl0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;556&quot; height=&quot;209&quot; data-origin-width=&quot;867&quot; data-origin-height=&quot;326&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 열의 데이터타입을 변경하려면, &lt;b&gt;MODIFY&amp;nbsp;&lt;/b&gt; 를 활용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;856&quot; data-origin-height=&quot;91&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/9YJ2V/btsIWEG7xet/w2vOsEEVREOjGx7eFN9wV1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/9YJ2V/btsIWEG7xet/w2vOsEEVREOjGx7eFN9wV1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/9YJ2V/btsIWEG7xet/w2vOsEEVREOjGx7eFN9wV1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F9YJ2V%2FbtsIWEG7xet%2Fw2vOsEEVREOjGx7eFN9wV1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;546&quot; height=&quot;58&quot; data-origin-width=&quot;856&quot; data-origin-height=&quot;91&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 열의 이름을 변경하려면, &lt;b&gt;CHANGE&lt;/b&gt; 를 활용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;862&quot; data-origin-height=&quot;282&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cpX4SH/btsIWTEeloU/dwzmBKpp3nnxFtXQbZdvkK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cpX4SH/btsIWTEeloU/dwzmBKpp3nnxFtXQbZdvkK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cpX4SH/btsIWTEeloU/dwzmBKpp3nnxFtXQbZdvkK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcpX4SH%2FbtsIWTEeloU%2FdwzmBKpp3nnxFtXQbZdvkK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;539&quot; height=&quot;282&quot; data-origin-width=&quot;862&quot; data-origin-height=&quot;282&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;기존 테이블의 이름을 변경하고 싶다면, &lt;b&gt;RENAME&lt;/b&gt; 을 활용합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;863&quot; data-origin-height=&quot;286&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dwZTkH/btsIYuwj2O7/OrMfx95NoqJlnDiNdkEcaK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dwZTkH/btsIYuwj2O7/OrMfx95NoqJlnDiNdkEcaK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dwZTkH/btsIYuwj2O7/OrMfx95NoqJlnDiNdkEcaK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdwZTkH%2FbtsIYuwj2O7%2FOrMfx95NoqJlnDiNdkEcaK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;567&quot; height=&quot;286&quot; data-origin-width=&quot;863&quot; data-origin-height=&quot;286&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 테이블 삭제 :: DROP TABLE&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;background-color: #b6e1f2;&quot;&gt;&lt;b&gt;DROP TABLE&lt;/b&gt;&lt;/span&gt;&amp;nbsp;명령어로 테이블 구조와 데이터를 모두 삭제할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;943&quot; data-origin-height=&quot;332&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bj3kXL/btsIWSyuBCt/5EB0sSDeLFPGlZyAYMVxg0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bj3kXL/btsIWSyuBCt/5EB0sSDeLFPGlZyAYMVxg0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bj3kXL/btsIWSyuBCt/5EB0sSDeLFPGlZyAYMVxg0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbj3kXL%2FbtsIWSyuBCt%2F5EB0sSDeLFPGlZyAYMVxg0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;596&quot; height=&quot;210&quot; data-origin-width=&quot;943&quot; data-origin-height=&quot;332&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고1: boostcourse 강좌 (기초 데이터 분석을 위한 핵심 SQL)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;참고2: &lt;a href=&quot;https://buly.kr/DwCTC3z&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://buly.kr/DwCTC3z&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/SQL</category>
      <category>alter table</category>
      <category>create table</category>
      <category>DDL</category>
      <category>DROP TABLE</category>
      <category>MySQL</category>
      <category>SQL</category>
      <category>sql 테이블</category>
      <category>table</category>
      <category>테이블</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/167</guid>
      <comments>https://sy-log.tistory.com/entry/SQL-DDL-SQL-%ED%85%8C%EC%9D%B4%EB%B8%94-%EC%83%9D%EC%84%B1-%EC%88%98%EC%A0%95-%EC%82%AD%EC%A0%9C%ED%95%98%EA%B8%B0#entry167comment</comments>
      <pubDate>Wed, 7 Aug 2024 21:12:28 +0900</pubDate>
    </item>
    <item>
      <title>[seaborn] 데이터프레임으로 빈도그래프 빈도차트 카운트차트 그리기 :: sns.countplot</title>
      <link>https://sy-log.tistory.com/entry/seaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EB%B9%88%EB%8F%84%EA%B7%B8%EB%9E%98%ED%94%84-%EB%B9%88%EB%8F%84%EC%B0%A8%ED%8A%B8-%EC%B9%B4%EC%9A%B4%ED%8A%B8%EC%B0%A8%ED%8A%B8-%EA%B7%B8%EB%A6%AC%EA%B8%B0-snscountplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;출발시간(departure_time)별로 빈도수가 어떻게 다른지 빈도 그래프&lt;/b&gt;를 작성해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1720616935614&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/RRiuq/btsIu4k7Wfk/3Abs2NyY3yr6sgDO7HLcWk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/RRiuq/btsIu4k7Wfk/3Abs2NyY3yr6sgDO7HLcWk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/RRiuq/btsIu4k7Wfk/3Abs2NyY3yr6sgDO7HLcWk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FRRiuq%2FbtsIu4k7Wfk%2F3Abs2NyY3yr6sgDO7HLcWk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;237&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; sns 빈도그래프 그리기&amp;nbsp; ::&amp;nbsp; sns.countplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;범주형데이터에 포함된 항목별로 빈도수를 카운트해서, 빈도그래프를 그리고 싶을 때 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.countplot&lt;/span&gt;을 활용할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;카운트할 칼럼은 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;x&lt;/span&gt; 에 넣어주면 됩니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;x = 'departure_time'&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼 내 항목들의 순서를 정하고 싶다면, 아래 코드처럼 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;order&lt;/span&gt;를 활용합니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;order = 리스트&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;여기서 범례를 추가하고 싶다면 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;hue&lt;/span&gt; 를 추가합니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;hue = 'class'&lt;/span&gt; 를 추가해서 좌석클래스 별로 그래프 컬러를 구분했습니다.&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1720681376197&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 빈도그래프 작성
countplot_1 = sns.countplot(
    data = df,                     # 데이터 지정
    x = 'departure_time',          # '출발시간' 기준으로 빈도그래프 작성
    order = ['Early_Morning','Morning','Afternoon','Evening','Night','Late_Night'],  # 데이터 순서
    hue = 'class',                 # '좌석클래스' 기준으로 색상 구분
    palette = plt.cm.Set2.colors   # 색상 팔레트 지정
)
# 데이터 라벨 추가
for i in countplot_1.containers:
    countplot_1.bar_label(i,fontsize=8)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;875&quot; data-origin-height=&quot;643&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cVmiuG/btsIwXL6iCk/b4Ix0Yfu7pymOf2kSOIZPK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cVmiuG/btsIwXL6iCk/b4Ix0Yfu7pymOf2kSOIZPK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cVmiuG/btsIwXL6iCk/b4Ix0Yfu7pymOf2kSOIZPK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcVmiuG%2FbtsIwXL6iCk%2Fb4Ix0Yfu7pymOf2kSOIZPK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;588&quot; height=&quot;432&quot; data-origin-width=&quot;875&quot; data-origin-height=&quot;643&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 빈도가 아닌 비율(퍼센트) 기준으로 그래프 작성하기 (percent)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그래프를 빈도수가 아닌 비율로 비교해서 작성하고 싶다면, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;stat = 'percent'&lt;/span&gt; 를 추가합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;막대별로 퍼센트수치 라벨을 표시하는 방법은 아래 코드를 참고해주세요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1720682805168&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 빈도그래프 작성
countplot_2 = sns.countplot(
    data = df,                     # 데이터 지정
    x = 'departure_time',          # '출발시간' 기준으로 빈도그래프 작성
    order = ['Early_Morning','Morning','Afternoon','Evening','Night','Late_Night'],  # 데이터 순서
    stat = 'percent',              # 빈도수를 퍼센트로 변환
    hue = 'class',                 # '좌석클래스' 기준으로 색상 구분
    palette = plt.cm.Set2.colors   # 색상 팔레트 지정
)
# 데이터 라벨 추가
for i in countplot_2.containers:
    countplot_2.bar_label(i,fontsize=8,fmt='%.2f%%')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;837&quot; data-origin-height=&quot;650&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/uXhYC/btsIvVaIcnB/HFkVGXPChOeKk3oDk9Lv8k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/uXhYC/btsIvVaIcnB/HFkVGXPChOeKk3oDk9Lv8k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/uXhYC/btsIvVaIcnB/HFkVGXPChOeKk3oDk9Lv8k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FuXhYC%2FbtsIvVaIcnB%2FHFkVGXPChOeKk3oDk9Lv8k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;589&quot; height=&quot;457&quot; data-origin-width=&quot;837&quot; data-origin-height=&quot;650&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 가로 그래프로 작성하기 (horizontal)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그래프를 가로로 작성하고 싶다면, x 대신 y 에 카운트할 칼럼을 넣어주면 됩니다. &lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000; text-align: left;&quot;&gt;y = 'departure_time'&lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1720682984643&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 빈도그래프 작성
countplot_3 = sns.countplot(
    data = df,                     # 데이터 지정
    y = 'departure_time',          # '출발시간' 기준으로 빈도그래프 작성
    order = ['Early_Morning','Morning','Afternoon','Evening','Night','Late_Night'],  # 데이터 순서
    stat = 'percent',              # 빈도수를 퍼센트로 변환
    hue = 'class',                 # '좌석클래스' 기준으로 색상 구분
    palette = plt.cm.Set2.colors   # 색상 팔레트 지정
)
# 데이터 라벨 추가
for i in countplot_3.containers:
    countplot_3.bar_label(i,fontsize=8,fmt='%.2f%%')

# x축 눈금 설정하기
countplot_3.set_xticks(np.arange(0,19,2))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;979&quot; data-origin-height=&quot;649&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b8pUQN/btsIvlAWHCn/YfqlOAbFR94q23RpVU8VD1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b8pUQN/btsIvlAWHCn/YfqlOAbFR94q23RpVU8VD1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b8pUQN/btsIvlAWHCn/YfqlOAbFR94q23RpVU8VD1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb8pUQN%2FbtsIvlAWHCn%2FYfqlOAbFR94q23RpVU8VD1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;681&quot; height=&quot;451&quot; data-origin-width=&quot;979&quot; data-origin-height=&quot;649&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>countplot</category>
      <category>seaborn</category>
      <category>sns.countplot</category>
      <category>빈도그래프</category>
      <category>빈도수그래프</category>
      <category>빈도수차트</category>
      <category>빈도차트</category>
      <category>카운트차트</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/166</guid>
      <comments>https://sy-log.tistory.com/entry/seaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EB%B9%88%EB%8F%84%EA%B7%B8%EB%9E%98%ED%94%84-%EB%B9%88%EB%8F%84%EC%B0%A8%ED%8A%B8-%EC%B9%B4%EC%9A%B4%ED%8A%B8%EC%B0%A8%ED%8A%B8-%EA%B7%B8%EB%A6%AC%EA%B8%B0-snscountplot#entry166comment</comments>
      <pubDate>Thu, 11 Jul 2024 16:46:10 +0900</pubDate>
    </item>
    <item>
      <title>데이터분석 모델링 프로세스, 머신러닝 AI 모델링 과정 요약 정리</title>
      <link>https://sy-log.tistory.com/entry/%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B6%84%EC%84%9D-%EB%AA%A8%EB%8D%B8%EB%A7%81-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4-%EB%A8%B8%EC%8B%A0%EB%9F%AC%EB%8B%9D-AI-%EB%AA%A8%EB%8D%B8%EB%A7%81-%EA%B3%BC%EC%A0%95-%EC%9A%94%EC%95%BD-%EC%A0%95%EB%A6%AC</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;2433&quot; data-origin-height=&quot;465&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Izwck/btsIox8HEeQ/gw8rukiqUC2SilGPGFfJj0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Izwck/btsIox8HEeQ/gw8rukiqUC2SilGPGFfJj0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Izwck/btsIox8HEeQ/gw8rukiqUC2SilGPGFfJj0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FIzwck%2FbtsIox8HEeQ%2Fgw8rukiqUC2SilGPGFfJj0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;2433&quot; height=&quot;465&quot; data-origin-width=&quot;2433&quot; data-origin-height=&quot;465&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1️⃣ &amp;nbsp;&lt;b&gt;데이터 파악&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.6512%; height: 229px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style4&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;width: 23.1395%; height: 22px; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; 데이터 유형 및 구조 &lt;br /&gt;파악하기 &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.8605%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&amp;bull; 정형/반정형/비정형 중 어떤 형태인지 파악&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt; &lt;b&gt;정형 데이터&lt;/b&gt;: 엑셀 스프레드 시트와 같은 테이블 형태의 데이터가 대표적&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt; &lt;b&gt;반정형 데이터&lt;/b&gt;: 로그, JSON, 이메일 등 일부 정형화 되어있으나 비교적 유연한 데이터 유형&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt;&lt;b&gt; 비정형 데이터&lt;/b&gt;: 이미지, 영상, 텍스트 등 정해진 구조나 형식이 없는 데이터, 분석을 위해 가공 필요. &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 23.1395%; height: 17px; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 학습에 &lt;br /&gt;영향 미칠 수 있는 &lt;br /&gt;모든 요소 파악하기&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.8605%; height: 17px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt; &lt;b&gt;수치형&lt;/b&gt; 데이터는 분포 및 요약통계량 확인&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt; &lt;b&gt;범주형&lt;/b&gt; 데이터는 빈도 및 교차표 등 확인&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;nbsp;데이터 중복 여부, 결측치 여부, 이상치 여부 확인 &amp;rarr; 전처리 필요한 요소들 확인&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 레이블링 여부 = 정답 = Y값이 있는지 확인 &amp;rarr; 있으면 지도학습, 없으면 비지도학습 모델이 될 것&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;2️⃣&amp;nbsp;&amp;nbsp;&lt;b&gt;데이터 전처리&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 243px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style4&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.2558%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 제거 및 대체&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.7442%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; &lt;b&gt;중복&lt;/b&gt; 데이터 제거&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; &lt;b&gt;결측치&lt;/b&gt; 처리 (특정값으로 채우기, 결측치 있는 데이터 행 제거, 결측치가 너무 많은 칼럼 제거 등)&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; &lt;b&gt;이상치&lt;/b&gt; 처리 (특정값으로 대체하기, 이상치 있는 데이터 행 제거 등)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.2558%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 변환&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.7442%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 필요시, 수치형 데이터 스케일링 (정규화, 표준화)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 필요시, 수치형 &amp;rarr; 범주형으로 변환 (구간화 등)&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 필요시, 범주형&amp;nbsp;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;rarr; 수치형으로 변환 (인코딩, 원핫인코딩 등)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.2558%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;분석가 판단에 의한&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 제거 및 추가&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.7442%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 모델 학습에 불필요한 데이터 제거&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 모델 학습에 필요한 파생 데이터 추가&lt;/span&gt; &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;3️⃣&amp;nbsp;&amp;nbsp;&lt;b&gt;분석 모델 선정&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.8837%; height: 182px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style4&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.9535%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;모델 선정 판단&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.0465%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; 데이터 유형 및 구조에 따라 사용할 수 있는 모델이 구분됨&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 레이블 = 정답 = Y값이 있다면 &amp;rarr; &lt;b&gt;지도학습&lt;/b&gt; 모델&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;rarr; 답이 둘중 하나라면 &quot;&lt;b&gt;분류&lt;/b&gt;&quot; 모델, 답이 연속적인 값이라면 &quot;&lt;b&gt;회귀&lt;/b&gt;&quot; 모델&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 레이블 = 정답 = Y값이 없다면 &amp;rarr; &lt;b&gt;비지도&lt;/b&gt;학습 모델&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;rarr; 답이 없다면 일반적으로 유사한 데이터끼리 묶는 &quot;&lt;b&gt;군집화&lt;/b&gt;&quot;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 23.9535%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그 외 고려해야할 요소들&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 76.0465%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; 투입할 수 있는 컴퓨팅 시스템 자원, 비용, 시간 등을 고려하여 적절한 수준의 모델 선정&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;4️⃣&amp;nbsp; &lt;b&gt;학습 데이터 분할&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.8837%; height: 463px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style4&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 24.3023%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;학습 데이터 분할&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.6977%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&amp;bull;데이터 분할&lt;br /&gt;&amp;nbsp; &amp;nbsp;- &lt;b&gt;학습 데이터&lt;/b&gt; (Training set): 이 데이터를 학습시켜서 모델을 생성함&lt;br /&gt;&amp;nbsp; &amp;nbsp;- &lt;b&gt;검증 데이터&lt;/b&gt; (Validation set): 학습에 사용되지 않은 데이터로 모델들의 정확도를 검증함&lt;br /&gt;&amp;nbsp; &amp;nbsp;- &lt;b&gt;평가 데이터&lt;/b&gt; (Test set): 학습,검증에 사용되지 않은 데이터로 모델의 성능을 최종평가함&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; 일반적으로 학습:검증:평가 = 6:2:2 혹은 7:2:1 비율로 분할함&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&amp;bull; 모델의 과적합 방지와 성능 평가를 위해, 데이터 분할은 필수!&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 24.3023%; text-align: center;&quot; rowspan=&quot;2&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 분할 및 &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;교차검증 방법&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.6977%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; 홀드아웃 교차검증: 랜덤 비복원 추출이므로, 평가데이터는 학습에 사용할 수 없음 (학습데이터 손실)&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 랜덤 서브샘플링: 홀드아웃을 반복하는 방법, 학습데이터 손실 없음&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; K-fold 교차검증: 데이터를 K개 부분집합으로 나눔, 이중 1개만 평가데이터로 쓰면서 K번 반복&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; LOOCV,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt; LpOCV: 전체데이터 N개중 1개 혹은 p개만 평가, 나머지는 학습데이터로 사용&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 부트스트랩: 랜덤 복원 추출, 동일크기 표본을 여러개 샘플링&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 75.6977%;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;935&quot; data-origin-height=&quot;236&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nSZ7x/btsIoMS2GXf/C54RPIkRzJG6wzCeuBxDh0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nSZ7x/btsIoMS2GXf/C54RPIkRzJG6wzCeuBxDh0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nSZ7x/btsIoMS2GXf/C54RPIkRzJG6wzCeuBxDh0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnSZ7x%2FbtsIoMS2GXf%2FC54RPIkRzJG6wzCeuBxDh0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;496&quot; height=&quot;125&quot; data-origin-width=&quot;935&quot; data-origin-height=&quot;236&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;5️⃣&amp;nbsp;&amp;nbsp;&lt;b&gt;모델 &lt;/b&gt;&lt;b&gt;학습 및 성능평가 반복&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 267px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style4&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 18px;&quot;&gt;
&lt;td style=&quot;width: 25.5814%; text-align: center; height: 18px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;모델 학습 및 평가&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 74.4186%; height: 18px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; 위에서 선정한 모델에 분할한 데이터를 넣고 &lt;b&gt;반복 학습&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 검증데이터, 평가데이터로 모델 &lt;b&gt;성능 평가&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 25.5814%; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;과적합 확인&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 74.4186%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 학습 횟수가 너무 많아지면, 학습데이터만 과하게 학습하는 과적합 발생할 수 있음&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull; 학습 반복하면서 변화하는 정확도 등의 평가지표를 시각화하여, 과적합 여부를 확인해야 함&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;bull;&lt;/span&gt; 일반적으로 과적합 발생 직전의 모델이 성능이 가장 우수함&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;width: 25.5814%; text-align: center; height: 17px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;필요 시 반복 반복..&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 74.4186%; height: 17px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt; &amp;bull; 성능평가 결과 목표치에 도달하지 못한다면,&lt;br /&gt;&amp;nbsp; &amp;nbsp;- 모델의 &lt;b&gt;가중치, 하이퍼 파라미터 등을 변경&lt;/b&gt;하며 학습과 평가를 반복&lt;br /&gt;&amp;nbsp; &amp;nbsp;- &lt;b&gt;전처리&lt;/b&gt;를 추가 진행한 데이터셋으로 시도해보기&lt;br /&gt;&amp;nbsp; &amp;nbsp;- 전체 데이터셋 양이 모자른 경우 더 수집/수급해보기 등등..&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>위키/데이터분석</category>
      <category>AI모델</category>
      <category>ai모델링 과정</category>
      <category>ai모델링 프로세스</category>
      <category>데이터분석</category>
      <category>데이터분석 모델</category>
      <category>데이터분석 모델링</category>
      <category>머신러닝</category>
      <category>머신러닝 모델</category>
      <category>머신러닝 모델링</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/165</guid>
      <comments>https://sy-log.tistory.com/entry/%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B6%84%EC%84%9D-%EB%AA%A8%EB%8D%B8%EB%A7%81-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4-%EB%A8%B8%EC%8B%A0%EB%9F%AC%EB%8B%9D-AI-%EB%AA%A8%EB%8D%B8%EB%A7%81-%EA%B3%BC%EC%A0%95-%EC%9A%94%EC%95%BD-%EC%A0%95%EB%A6%AC#entry165comment</comments>
      <pubDate>Fri, 5 Jul 2024 15:23:59 +0900</pubDate>
    </item>
    <item>
      <title>회귀모델 평가지표 - R2 score 결정계수, MAE, MSE, RMSE, MAPE, MPE</title>
      <link>https://sy-log.tistory.com/entry/%ED%9A%8C%EA%B7%80%EB%AA%A8%EB%8D%B8-%ED%8F%89%EA%B0%80%EC%A7%80%ED%91%9C-R2-score-%EA%B2%B0%EC%A0%95%EA%B3%84%EC%88%98-MAE-MSE-RMSE-MAPE-MPE</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1134&quot; data-origin-height=&quot;554&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cxrzrg/btsIm5L7q74/Jo0cc8WMrkn7e51pTTR7H1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cxrzrg/btsIm5L7q74/Jo0cc8WMrkn7e51pTTR7H1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cxrzrg/btsIm5L7q74/Jo0cc8WMrkn7e51pTTR7H1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcxrzrg%2FbtsIm5L7q74%2FJo0cc8WMrkn7e51pTTR7H1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1134&quot; height=&quot;554&quot; data-origin-width=&quot;1134&quot; data-origin-height=&quot;554&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅ &lt;b&gt;R&amp;sup2; score = 결정계수&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;R&amp;sup2; score 는 회귀모델이 데이터에 얼마나 적합한지 나타내는 지표입니다.&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1에 가까울수록, 모델 성능이 좋다고 평가합니다.&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;회귀모델의 기본적인 평가지표는 아래와 같이 계산합니다.&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;SSE&lt;/b&gt; = 오차제곱합 = &amp;sum;(예측값과 실제값의 차이)&amp;sup2;&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;SSR&lt;/b&gt; = 회귀제곱합 = &lt;span style=&quot;text-align: left;&quot;&gt;&amp;sum;&lt;/span&gt;(예측값과 평균값의 차이)&lt;span style=&quot;text-align: left;&quot;&gt;&amp;sup2;&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;SST&lt;/b&gt; = 전체제곱합 = &lt;span style=&quot;text-align: left;&quot;&gt;&amp;sum;(실제&lt;/span&gt;값과 평균값의 차이)&lt;span style=&quot;text-align: left;&quot;&gt;&amp;sup2;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;R&amp;sup2; score = 결정계수&lt;/b&gt; = SSR / SST = 1 - (SSE / SST)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅ 오차 = 실제값과 예측값의 차이 를 이용한 평가지표들&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;MAE&lt;/b&gt; = Mean Absolute Error = 평균 절대 오차 = &lt;span style=&quot;text-align: left;&quot;&gt;&amp;sum;&lt;/span&gt;|예측값과 실제값의 차이|&lt;span style=&quot;text-align: left;&quot;&gt;&amp;sup2; / 전체 개수&lt;br /&gt;&lt;/span&gt;- 오차가 작을수록 = MAE값이 작을수록, 모델 성능이 좋음.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;MSE&lt;/b&gt; = Mean Squared Error = 평균 제곱 오차 = &lt;span style=&quot;text-align: left;&quot;&gt;&amp;sum;(&lt;/span&gt;예측값과 실제값의 차이)&lt;span style=&quot;text-align: left;&quot;&gt;&amp;sup2; / 전체 개수&lt;br /&gt;- 오차가 작을수록 = MSE값이 작을수록, 모델 성능이 좋음.&lt;br /&gt;- 제곱을 취하기 때문에, 특이값이 있는 경우 영향을 크게 받음. 즉 특이값에 민감한 지표.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&lt;b&gt;RMSE&lt;/b&gt;&amp;nbsp;=&amp;nbsp;Root&amp;nbsp;Mean&amp;nbsp;Squared&amp;nbsp;Error&amp;nbsp;=&amp;nbsp;평균&amp;nbsp;제곱근&amp;nbsp;오차&lt;br /&gt;- MSE에 루트를 씌워서 값을 축소시킨 지표. RMSE값이 작을수록, 모델 성능이 좋음.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;MAPE&lt;/b&gt;&amp;nbsp;=&amp;nbsp;Mean&amp;nbsp;Absolute&amp;nbsp;Percentage&amp;nbsp;Error&amp;nbsp;=&amp;nbsp;평균&amp;nbsp;절대&amp;nbsp;백분율&amp;nbsp;오차&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- MAE를 비율(%)로 나타낸 지표. 백분율이므로 다른 모델과 비교하기 좋음.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- MAPE값이 작을수록 = 0%에 가까울수록, 모델 성능이 좋음. &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;MPE&lt;/b&gt;&amp;nbsp;=&amp;nbsp;Mean&amp;nbsp;Percentage&amp;nbsp;Error&amp;nbsp;=&amp;nbsp;평균&amp;nbsp;백분율&amp;nbsp;오차&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- MPE에서 절댓값을 제외한 지표. 백분율이므로 다른 모델과 비교하기 좋음.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; - MAPE값이 0%에 가까울수록, 모델 성능이 좋음.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1082&quot; data-origin-height=&quot;819&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/drewIW/btsImIX2vP8/NjYBgO5J9NfICxBD0ODWOK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/drewIW/btsImIX2vP8/NjYBgO5J9NfICxBD0ODWOK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/drewIW/btsImIX2vP8/NjYBgO5J9NfICxBD0ODWOK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdrewIW%2FbtsImIX2vP8%2FNjYBgO5J9NfICxBD0ODWOK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;665&quot; height=&quot;503&quot; data-origin-width=&quot;1082&quot; data-origin-height=&quot;819&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;</description>
      <category>위키/데이터분석</category>
      <category>Mae</category>
      <category>MAPE</category>
      <category>MPE</category>
      <category>MSE</category>
      <category>r2 score</category>
      <category>RMSE</category>
      <category>SST</category>
      <category>결정계수</category>
      <category>평가지표</category>
      <category>회귀모델 평가지표</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/164</guid>
      <comments>https://sy-log.tistory.com/entry/%ED%9A%8C%EA%B7%80%EB%AA%A8%EB%8D%B8-%ED%8F%89%EA%B0%80%EC%A7%80%ED%91%9C-R2-score-%EA%B2%B0%EC%A0%95%EA%B3%84%EC%88%98-MAE-MSE-RMSE-MAPE-MPE#entry164comment</comments>
      <pubDate>Thu, 4 Jul 2024 22:12:03 +0900</pubDate>
    </item>
    <item>
      <title>분류모델 평가지표 - 오차행렬 혼동행렬, 정확도 재현율 정밀도 F1-score, ROC곡선 AUC</title>
      <link>https://sy-log.tistory.com/entry/%EB%B6%84%EB%A5%98%EB%AA%A8%EB%8D%B8-%ED%8F%89%EA%B0%80%EC%A7%80%ED%91%9C-%EC%98%A4%EC%B0%A8%ED%96%89%EB%A0%AC-%ED%98%BC%EB%8F%99%ED%96%89%EB%A0%AC-%EC%A0%95%ED%99%95%EB%8F%84-%EC%9E%AC%ED%98%84%EC%9C%A8-%EC%A0%95%EB%B0%80%EB%8F%84-F1-score-ROC%EA%B3%A1%EC%84%A0-AUC</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;908&quot; data-origin-height=&quot;338&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bij6nd/btsInoxCJ1n/C1cwmNtZip8vxPv8KMdLH0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bij6nd/btsInoxCJ1n/C1cwmNtZip8vxPv8KMdLH0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bij6nd/btsInoxCJ1n/C1cwmNtZip8vxPv8KMdLH0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbij6nd%2FbtsInoxCJ1n%2FC1cwmNtZip8vxPv8KMdLH0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;790&quot; height=&quot;294&quot; data-origin-width=&quot;908&quot; data-origin-height=&quot;338&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅ &lt;b&gt;오차행렬 = 혼동행렬 = Confusion Matrix&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;오차행렬은 분류모델을 평가하는 데 가장 많이 사용되는 지표 중 하나입니다. &lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터의 답이 Positive / Negative 2가지로만 분류되는 상황에서, 발생 가능한 경우의 수는 아래 4가지 뿐입니다.&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;TP&lt;/b&gt; (True Positive) : 예측값이 Pos = 실제값도 Pos&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;FP&lt;/b&gt; (False Positive) : 예측값이 Pos &amp;ne; 실제값은 Neg&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;FN&lt;/b&gt; (False Negative) : 예측값이 Neg &lt;span style=&quot;text-align: left;&quot;&gt;&amp;ne;&lt;/span&gt; 실제값은 Pos&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;TN&lt;/b&gt; (True Negative) : &lt;span style=&quot;text-align: left;&quot;&gt;예측값이 Neg = 실제값도 Neg&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;위 4가지 경우를 가지고 &lt;b&gt;분류모델의 평가지표&lt;/b&gt;를 계산할 수 있습니다.&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;정확도&lt;/b&gt; : 분류모델이 실제값을 정확하게 예측한 비율&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;Accuracy&lt;/b&gt; = (TP + TN) / (TP + TN + FP + FN)&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;text-align: left;&quot;&gt;✔️ &lt;b&gt;재현율&lt;/b&gt; : 분류모델이 실제 Pos를 Pos로 예측한 비율&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;Recall&lt;/b&gt; = TP / (TP + FN)&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️&lt;b&gt; 정밀도&lt;/b&gt; : 분류모델이 Pos로 예측한 것들 중 실제 Pos의 비율&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;Precision&lt;/b&gt; = TP / (TP + FP)&lt;br /&gt;&lt;span style=&quot;text-align: left;&quot;&gt;✔️&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;b&gt; F1-score&lt;/b&gt; : 재현율과 정밀도의 조화평균&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F1-score = 2 &amp;times; ((재현율 &lt;span style=&quot;text-align: left;&quot;&gt;&amp;times; 정밀도) / (재현율 + 정밀도))&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;균형&lt;/b&gt;있는 데이터의 경우, 정확도(Accuracy)와 F1-score &lt;b&gt;둘다&lt;/b&gt;&amp;nbsp;평가지표로 활용할 수 있습니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;편중&lt;/b&gt;된 데이터의 경우, 정확도만으로 모델의 성능을 판단하기에 효과적이지 않고, &lt;b&gt;F1-score&lt;/b&gt;를 활용하는 것이 좋습니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;994&quot; data-origin-height=&quot;762&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bIY5A1/btsImLUiGPF/2ONimB5bdgRRuVne29Rxfk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bIY5A1/btsImLUiGPF/2ONimB5bdgRRuVne29Rxfk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bIY5A1/btsImLUiGPF/2ONimB5bdgRRuVne29Rxfk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbIY5A1%2FbtsImLUiGPF%2F2ONimB5bdgRRuVne29Rxfk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;792&quot; height=&quot;607&quot; data-origin-width=&quot;994&quot; data-origin-height=&quot;762&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 342px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style16&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 186px;&quot;&gt;
&lt;td style=&quot;width: 62.2093%; text-align: center; height: 342px;&quot; rowspan=&quot;2&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;622&quot; data-origin-height=&quot;600&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nEF33/btsIoyMBJvV/2Xv3GUxRn14ThsR7kPzNsk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nEF33/btsIoyMBJvV/2Xv3GUxRn14ThsR7kPzNsk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nEF33/btsIoyMBJvV/2Xv3GUxRn14ThsR7kPzNsk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnEF33%2FbtsIoyMBJvV%2F2Xv3GUxRn14ThsR7kPzNsk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;419&quot; height=&quot;404&quot; data-origin-width=&quot;622&quot; data-origin-height=&quot;600&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 37.7907%; height: 186px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&lt;b&gt;가로축&lt;/b&gt;&lt;br /&gt;&amp;nbsp;= False Positive Rate&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;nbsp;= &lt;b&gt;FPR&lt;/b&gt; = FP / (FP + TN)&lt;br /&gt;&amp;nbsp;= 실제 Neg를 Pos로 잘못 예측한 비율&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(낮을수록 좋은 값!)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 156px;&quot;&gt;
&lt;td style=&quot;width: 37.7907%; height: 156px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;세로축&lt;/b&gt;&lt;br /&gt;&amp;nbsp;= True Positive Rate&lt;br /&gt;&amp;nbsp;= &lt;b&gt;TPR&lt;/b&gt; = TP / (TP + FN)&lt;br /&gt;&amp;nbsp;= 실제 Pos를 Pos로 맞게 예측한 비율&lt;br /&gt;&amp;nbsp; &amp;nbsp; (높을수록 좋은 값!)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅ ROC곡선 &amp;amp; AUC&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;ROC곡선&lt;/b&gt;은 FPR의 변화에 따른 TPR의 변화를 나타내는 곡선입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;AUC는 ROC곡선 아래의 면적&lt;/b&gt;을 나타내는 값입니다. 0.5~1.0 사이의 값을 가집니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;ROC곡선이 직각에 가까울수록 = 왼쪽 꼭대기에 가까울수록= AUC는 1에 가까울수록&lt;/b&gt;, 모델의 성능이 좋다고 판단합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>위키/데이터분석</category>
      <category>AUC</category>
      <category>Confusion matrix</category>
      <category>F1 score</category>
      <category>ROC</category>
      <category>roc곡선</category>
      <category>오차행렬</category>
      <category>재현율</category>
      <category>정밀도</category>
      <category>정확도</category>
      <category>혼동행렬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/163</guid>
      <comments>https://sy-log.tistory.com/entry/%EB%B6%84%EB%A5%98%EB%AA%A8%EB%8D%B8-%ED%8F%89%EA%B0%80%EC%A7%80%ED%91%9C-%EC%98%A4%EC%B0%A8%ED%96%89%EB%A0%AC-%ED%98%BC%EB%8F%99%ED%96%89%EB%A0%AC-%EC%A0%95%ED%99%95%EB%8F%84-%EC%9E%AC%ED%98%84%EC%9C%A8-%EC%A0%95%EB%B0%80%EB%8F%84-F1-score-ROC%EA%B3%A1%EC%84%A0-AUC#entry163comment</comments>
      <pubDate>Thu, 4 Jul 2024 17:37:35 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 칼럼 나누기, 칼럼 합치기 :: split() join() apply()</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%B9%BC%EB%9F%BC-%EB%82%98%EB%88%84%EA%B8%B0-%EC%B9%BC%EB%9F%BC-%ED%95%A9%EC%B9%98%EA%B8%B0-split-join-apply</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;비행사(airline), 비행편 이름(flight) 칼럼만 가져왔고, &lt;b&gt;비행편 이름 칼럼으로 칼럼 나누기 합치기&lt;/b&gt; 테스트를 해볼게요.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719976066196&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 데이터셋 불러오기 : 비행사, 비행편 이름만
df = pd.read_csv('./Clean_Dataset.csv', usecols=['airline', 'flight'], encoding='cp949')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1693&quot; data-origin-height=&quot;803&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6cKQj/btsIj8JbId4/SAM3jrMkAifmIfeDkhRkf0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6cKQj/btsIj8JbId4/SAM3jrMkAifmIfeDkhRkf0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6cKQj/btsIj8JbId4/SAM3jrMkAifmIfeDkhRkf0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6cKQj%2FbtsIj8JbId4%2FSAM3jrMkAifmIfeDkhRkf0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;847&quot; height=&quot;402&quot; data-origin-width=&quot;1693&quot; data-origin-height=&quot;803&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 칼럼 나누기&amp;nbsp; ::&amp;nbsp; .str.split()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;비행편 이름(flight) &lt;b&gt;중간의 '-' 를 기준으로 나눠서&lt;/b&gt;, 제조사(manufacturer)와 모델이름(model) &lt;b&gt;칼럼 2개&lt;/b&gt;로 나눠보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;.str.split()&lt;/span&gt; 메소드를 이용하면 특정 문자열 혹은 공백을 기준으로 나눌 수 있습니다.&lt;br /&gt;파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;expand=True&lt;/span&gt; 를 넣어줘야 데이터프레임 형태로 반환해줍니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719976286479&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 칼럼 1개를 여러개로 나누기
df[['manufacturer', 'model']] = df['flight'].str.split('-', expand=True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1666&quot; data-origin-height=&quot;810&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/FY3xc/btsIlQzYjfs/F4njmbPqhtVOUfAMea2OFK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/FY3xc/btsIlQzYjfs/F4njmbPqhtVOUfAMea2OFK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/FY3xc/btsIlQzYjfs/F4njmbPqhtVOUfAMea2OFK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFY3xc%2FbtsIlQzYjfs%2FF4njmbPqhtVOUfAMea2OFK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1666&quot; height=&quot;810&quot; data-origin-width=&quot;1666&quot; data-origin-height=&quot;810&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 칼럼 합치기&amp;nbsp; ::&amp;nbsp; apply, lambda, join&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;위에서 나눈 &lt;b&gt;칼럼 2개를 다시 합쳐서&lt;/b&gt; 원래 칼럼과 동일한 형태로 만들어볼게요.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;&quot;&gt;칼럼을 합칠 때는 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;apply()&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;lambda&lt;/span&gt;함수를 사용했습니다.&lt;br /&gt;'-' 를 기준으로 두개 칼럼의 문자열이 합쳐지도록 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;join()&lt;/span&gt; 메소드를 넣었어요.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719976408176&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 칼럼 여러개를 1개로 합치기
df['flight_new'] = df[['manufacturer', 'model']].apply(lambda x: '-'.join(x.values.astype(str)), axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;2049&quot; data-origin-height=&quot;950&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bfur0g/btsIjJo57mS/kskAb5aXJRGDsKnDbdPPOk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bfur0g/btsIjJo57mS/kskAb5aXJRGDsKnDbdPPOk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bfur0g/btsIjJo57mS/kskAb5aXJRGDsKnDbdPPOk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbfur0g%2FbtsIjJo57mS%2FkskAb5aXJRGDsKnDbdPPOk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;2049&quot; height=&quot;950&quot; data-origin-width=&quot;2049&quot; data-origin-height=&quot;950&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;참고 문서: &lt;a style=&quot;color: #000000;&quot; href=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1719977488298&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;pandas.Series.str.split &amp;mdash; pandas 2.2.2 documentation&quot; data-og-description=&quot;If False, return Series/Index, containing lists of strings.&quot; data-og-host=&quot;pandas.pydata.org&quot; data-og-source-url=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html&quot; data-og-url=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html&quot; data-og-image=&quot;&quot;&gt;&lt;a href=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url();&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;pandas.Series.str.split &amp;mdash; pandas 2.2.2 documentation&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;If False, return Series/Index, containing lists of strings.&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;pandas.pydata.org&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>df.apply</category>
      <category>Join</category>
      <category>pandas</category>
      <category>python lambda</category>
      <category>Split</category>
      <category>데이터프레임 칼럼나누기</category>
      <category>데이터프레임 칼럼합치기</category>
      <category>칼럼 나누기</category>
      <category>칼럼 합치기</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/162</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%B9%BC%EB%9F%BC-%EB%82%98%EB%88%84%EA%B8%B0-%EC%B9%BC%EB%9F%BC-%ED%95%A9%EC%B9%98%EA%B8%B0-split-join-apply#entry162comment</comments>
      <pubDate>Wed, 3 Jul 2024 12:33:22 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas][sklearn] 정규화, 표준화 - 수치형데이터 스케일링 :: MinMaxScaler StandardScaler</title>
      <link>https://sy-log.tistory.com/entry/Pandassklearn-%EC%A0%95%EA%B7%9C%ED%99%94-%ED%91%9C%EC%A4%80%ED%99%94-%EC%88%98%EC%B9%98%ED%98%95%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%8A%A4%EC%BC%80%EC%9D%BC%EB%A7%81-MinMaxScaler-StandardScaler</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅&amp;nbsp; 수치형데이터 스케일링 (Scaling)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 98.9535%; height: 306px;&quot; border=&quot;1&quot; data-ke-style=&quot;style2&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center; width: 19.2955%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;스케일링&lt;br /&gt;(Scaling)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 80.7045%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&amp;bull; 수치형 데이터가 여러개 있는데&amp;nbsp;&lt;b&gt;숫자범위가 다르다면 &amp;rarr; 범위를 비슷하게&amp;nbsp;&lt;/b&gt;만들어줄&amp;nbsp;필요가&amp;nbsp;있다. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;왜냐하면?&amp;nbsp;그대로&amp;nbsp;모델링하면&amp;nbsp;상대적으로&amp;nbsp;큰&amp;nbsp;숫자를&amp;nbsp;가지는&amp;nbsp;칼럼의&amp;nbsp;기여도가&amp;nbsp;더&amp;nbsp;크게&amp;nbsp;반영되어버리기&amp;nbsp;때문! &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;따라서&amp;nbsp;&lt;b&gt;스케일링하여&amp;nbsp;상대적인&amp;nbsp;크기&amp;nbsp;차이를&amp;nbsp;없애줘야&amp;nbsp;함 &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;스케일링을&amp;nbsp;통해&amp;nbsp;데이터의&amp;nbsp;불필요한&amp;nbsp;차원을&amp;nbsp;줄이고,&amp;nbsp;분석모델의&amp;nbsp;학습속도가&amp;nbsp;향상시킬&amp;nbsp;수&amp;nbsp;있음&amp;nbsp;(효율&amp;uarr;)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center; width: 19.2955%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;정규화&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;(Normalization)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 80.7045%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;&lt;b&gt;Min-Max Scaling&amp;nbsp;&lt;/b&gt;:&amp;nbsp;데이터의&amp;nbsp;&lt;b&gt;최솟값,&amp;nbsp;최댓값&lt;/b&gt;을&amp;nbsp;이용해서&amp;nbsp;데이터를&amp;nbsp;일정&amp;nbsp;범위&amp;nbsp;내의&amp;nbsp;값들로&amp;nbsp;변환 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;일반적으로&amp;nbsp;&lt;b&gt;0~1&amp;nbsp;사이&lt;/b&gt;의&amp;nbsp;값으로&amp;nbsp;변환 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #009a87;&quot;&gt;&lt;span style=&quot;text-align: start;&quot;&gt;※&amp;nbsp;&lt;/span&gt;데이터에&amp;nbsp;이상치가&amp;nbsp;없고,&amp;nbsp;분포가&amp;nbsp;크게&amp;nbsp;치우쳐&amp;nbsp;있지&amp;nbsp;않은&amp;nbsp;경우에&amp;nbsp;적합한&amp;nbsp;방법&lt;/span&gt;&amp;nbsp;(이상치&amp;nbsp;제거&amp;nbsp;후&amp;nbsp;정규화해야함)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center; width: 19.2955%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;표준화&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;(Standardization)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 80.7045%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull;&amp;nbsp;&lt;/span&gt;데이터의&amp;nbsp;&lt;b&gt;평균,&amp;nbsp;표준편차&lt;/b&gt;를 이용해서 변환&lt;br /&gt;&lt;span style=&quot;color: #000000; text-align: start;&quot;&gt;&amp;bull;&lt;/span&gt; &lt;b&gt;평균=0, 표준편차=1 &lt;/b&gt;이 되도록 데이터 값들을 변환 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #009a87;&quot;&gt; &lt;span style=&quot;text-align: start;&quot;&gt;※&lt;/span&gt; &amp;nbsp;데이터에 이상치가 있고, 분포가 치우쳐 있는 경우 적합한 방법&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style6&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;수치형 칼럼인 비행시간(duration), 출발까지 남은일수(days_left), 가격(price) 만&lt;/b&gt; 가져와서 스케일링을 해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719903118949&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import numpy as np
import pandas as pd
pd.set_option('float_format', '{:.4f}'.format)

# 데이터셋 불러오기 (수치형 칼럼만)
df = pd.read_csv('./Clean_Dataset.csv', usecols=['duration','days_left','price'], encoding='cp949')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1283&quot; data-origin-height=&quot;605&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/tY5B2/btsIj8u5AJb/uI1ta3Riym5bQMcGTzJygK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/tY5B2/btsIj8u5AJb/uI1ta3Riym5bQMcGTzJygK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/tY5B2/btsIj8u5AJb/uI1ta3Riym5bQMcGTzJygK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FtY5B2%2FbtsIj8u5AJb%2FuI1ta3Riym5bQMcGTzJygK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;786&quot; height=&quot;371&quot; data-origin-width=&quot;1283&quot; data-origin-height=&quot;605&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-1.&amp;nbsp; 정규화 (Normalization)&amp;nbsp; =&amp;nbsp; Min-Max Scaling&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래와 같이 데이터프레임의 각 칼럼마다 &lt;b&gt;최솟값, 최댓값&lt;/b&gt;을 이용해서 &lt;b&gt;특정 범위의 값으로 정규화&lt;/b&gt;할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 94px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style9&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 25px;&quot;&gt;
&lt;td style=&quot;width: 50%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0~1 사이의 값으로 정규화&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center; height: 25px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;a~b 사이의 값으로 정규화&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 69px;&quot;&gt;
&lt;td style=&quot;width: 50%; text-align: center; height: 69px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;623&quot; data-origin-height=&quot;85&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Z189Z/btsIlaS2VBV/m0hgajixl5yKMScju3xbpK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Z189Z/btsIlaS2VBV/m0hgajixl5yKMScju3xbpK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Z189Z/btsIlaS2VBV/m0hgajixl5yKMScju3xbpK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FZ189Z%2FbtsIlaS2VBV%2Fm0hgajixl5yKMScju3xbpK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;623&quot; height=&quot;85&quot; data-origin-width=&quot;623&quot; data-origin-height=&quot;85&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center; height: 69px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;634&quot; data-origin-height=&quot;77&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/XmhB1/btsIj6D5KuJ/PEUSbF18RzqhHktLUqt3k0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/XmhB1/btsIj6D5KuJ/PEUSbF18RzqhHktLUqt3k0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/XmhB1/btsIj6D5KuJ/PEUSbF18RzqhHktLUqt3k0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FXmhB1%2FbtsIj6D5KuJ%2FPEUSbF18RzqhHktLUqt3k0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;634&quot; height=&quot;77&quot; data-origin-width=&quot;634&quot; data-origin-height=&quot;77&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre id=&quot;code_1719903427334&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 정규화: 0~1 사이의 값으로 변환
df_norm_01 = (df - df.min()) / (df.max() - df.min())

# 정규화: 1~10 사이의 값으로 변환
df_norm_10 = ((df - df.min()) / (df.max() - df.min())) * (10-1) + 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1723&quot; data-origin-height=&quot;1073&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bmx1MG/btsIkdv9Sdg/n9KzoGSFNBOjLDKgRvTdK1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bmx1MG/btsIkdv9Sdg/n9KzoGSFNBOjLDKgRvTdK1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bmx1MG/btsIkdv9Sdg/n9KzoGSFNBOjLDKgRvTdK1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbmx1MG%2FbtsIkdv9Sdg%2Fn9KzoGSFNBOjLDKgRvTdK1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1723&quot; height=&quot;1073&quot; data-origin-width=&quot;1723&quot; data-origin-height=&quot;1073&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-2.&amp;nbsp; 사이킷런으로 정규화 (Normalization)&amp;nbsp; ::&amp;nbsp; MinMaxScaler()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;사이킷런의 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;MinMaxScaler()&lt;/span&gt; 모듈로도 데이터프레임을 정규화시킬 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 array 형태로 결과를 반환하기 때문에, 아래와 같이 다시 데이터프레임으로 바꿔줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719904332515&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 스케일러 모듈 불러오기
from sklearn.preprocessing import MinMaxScaler
mms = MinMaxScaler()

# 정규화하고 데이터프레임으로 바꿔주기
arr_norm_sklearn = mms.fit_transform(df)
df_norm_sklearn = pd.DataFrame(arr_norm_sklearn, columns=df.columns)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1334&quot; data-origin-height=&quot;629&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cUByCX/btsIjamF9Db/aMw6U56EU1PaD2MEhDOpq1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cUByCX/btsIjamF9Db/aMw6U56EU1PaD2MEhDOpq1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cUByCX/btsIjamF9Db/aMw6U56EU1PaD2MEhDOpq1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcUByCX%2FbtsIjamF9Db%2FaMw6U56EU1PaD2MEhDOpq1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1334&quot; height=&quot;629&quot; data-origin-width=&quot;1334&quot; data-origin-height=&quot;629&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-1.&amp;nbsp; 표준화 (Standardization)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래와 같이 데이터프레임의 각 칼럼마다 &lt;b&gt;평균값, 표준편차를 이용해서 표준화&lt;/b&gt;할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;표준화하면, &lt;b&gt;평균=0 이고 표준편차=1 인 표준정규분포 상의 값들&lt;/b&gt;로 모든 데이터 값들이 변환됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 32px;&quot; border=&quot;1&quot; data-ke-style=&quot;style9&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 21px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 99.8837%; height: 21px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;평균 &amp;amp; 표준편차로 데이터 표준화&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 11px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 99.8837%; height: 11px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;623&quot; data-origin-height=&quot;84&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/xpn6u/btsIlndxQvO/MDmTlGxBvJpN1wtXm3C2hK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/xpn6u/btsIlndxQvO/MDmTlGxBvJpN1wtXm3C2hK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/xpn6u/btsIlndxQvO/MDmTlGxBvJpN1wtXm3C2hK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fxpn6u%2FbtsIlndxQvO%2FMDmTlGxBvJpN1wtXm3C2hK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;370&quot; height=&quot;50&quot; data-origin-width=&quot;623&quot; data-origin-height=&quot;84&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre id=&quot;code_1719905028174&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 표준화
df_std = (df - df.mean()) / df.std()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1582&quot; data-origin-height=&quot;1046&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/MHWyw/btsIkjwhYHQ/Vu18wXQgg9bNKnsTvYUt0k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/MHWyw/btsIkjwhYHQ/Vu18wXQgg9bNKnsTvYUt0k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/MHWyw/btsIkjwhYHQ/Vu18wXQgg9bNKnsTvYUt0k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FMHWyw%2FbtsIkjwhYHQ%2FVu18wXQgg9bNKnsTvYUt0k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1582&quot; height=&quot;1046&quot; data-origin-width=&quot;1582&quot; data-origin-height=&quot;1046&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-2.&amp;nbsp; 사이킷런으로 표준화 (Standardization) &amp;nbsp;::&amp;nbsp; StandardScaler()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;사이킷런의 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;StandardScaler()&lt;/span&gt; 모듈로도 데이터프레임을 표준화시킬 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 array 형태로 결과를 반환하기 때문에, 아래와 같이 다시 데이터프레임으로 바꿔줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719904952183&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 스케일러 모듈 가져오기
from sklearn.preprocessing import StandardScaler
ss = StandardScaler()

# 표준화하고 데이터프레임으로 바꿔주기
arr_std_sklearn = ss.fit_transform(df)
df_std_sklearn = pd.DataFrame(arr_std_sklearn, columns=df.columns)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1301&quot; data-origin-height=&quot;633&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/SpLng/btsIle8NltT/pSVBzr63KDksKLrfp6lCYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/SpLng/btsIle8NltT/pSVBzr63KDksKLrfp6lCYK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/SpLng/btsIle8NltT/pSVBzr63KDksKLrfp6lCYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FSpLng%2FbtsIle8NltT%2FpSVBzr63KDksKLrfp6lCYK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1301&quot; height=&quot;633&quot; data-origin-width=&quot;1301&quot; data-origin-height=&quot;633&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>normalization</category>
      <category>pandas</category>
      <category>scaling</category>
      <category>sklearn</category>
      <category>standardization</category>
      <category>사이킷런</category>
      <category>스케일링</category>
      <category>정규화</category>
      <category>판다스</category>
      <category>표준화</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/161</guid>
      <comments>https://sy-log.tistory.com/entry/Pandassklearn-%EC%A0%95%EA%B7%9C%ED%99%94-%ED%91%9C%EC%A4%80%ED%99%94-%EC%88%98%EC%B9%98%ED%98%95%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%8A%A4%EC%BC%80%EC%9D%BC%EB%A7%81-MinMaxScaler-StandardScaler#entry161comment</comments>
      <pubDate>Tue, 2 Jul 2024 16:30:08 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas][sklearn] 인코딩, 원핫인코딩 범주형데이터 수치형으로 변환하기 :: pd.factorize pd.get_dummies</title>
      <link>https://sy-log.tistory.com/entry/Pandassklearn-%EC%9D%B8%EC%BD%94%EB%94%A9-%EC%9B%90%ED%95%AB%EC%9D%B8%EC%BD%94%EB%94%A9-%EB%B2%94%EC%A3%BC%ED%98%95%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%88%98%EC%B9%98%ED%98%95%EC%9C%BC%EB%A1%9C-%EB%B3%80%ED%99%98%ED%95%98%EA%B8%B0-pdfactorize-pdgetdummies</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅&amp;nbsp; 범주형 인코딩 (Categorical Encoding)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 226px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 44px;&quot;&gt;
&lt;td style=&quot;text-align: center; height: 44px; width: 24.7674%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;범주형 인코딩&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 44px; width: 75.2326%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; &lt;b&gt;텍스트로 이루어진 범주형 데이터를 수치형 데이터로&amp;nbsp;변환하는 것.&lt;br /&gt;&lt;/b&gt; &lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; 인코딩하는 이유: 데이터 양이 방대한 경우, 텍스트로 이루어진 범주형은 수치로 변환해줘야 &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;데이터 처리속도가 향상됨 &lt;span style=&quot;color: #9d9d9d;&quot;&gt;(다시 말해 컴퓨터가 가장 이해하기 쉬운 언어인 숫자로 바꿔주는 게 좋다)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;text-align: center; height: 22px; width: 24.7674%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;레이블/라벨 인코딩&lt;br /&gt;(Label Encoding)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 22px; width: 75.2326%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; 범주형 데이터에 숫자 레이블/라벨을 할당함 = &lt;b&gt;범주마다 번호를 매김&lt;br /&gt;&lt;/b&gt;(ex) 월요일은 1, 화요일은 2, 수요일은 3, ...&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;text-align: center; height: 22px; width: 24.7674%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;원핫 인코딩&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;(OneHot Encoding)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 22px; width: 75.2326%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt;&amp;bull; 범주별로 칼럼을 만들어서, 칼럼안에 &lt;b&gt;1 아니면 0 만 넣는다&lt;br /&gt;&lt;/b&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; 한 칼럼에만 1(True) 이 들어가고, 나머지 칼럼들은 0(False) 가 들어가는 방식&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;레이블 인코딩은 비행사(airline) 칼럼&lt;/b&gt;으로 해보고, &lt;b&gt;원핫 인코딩은 좌석클래스(class) 칼럼&lt;/b&gt;으로 테스트 해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719841504521&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;2000&quot; data-origin-height=&quot;372&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/UqBv2/btsIkEGdmq5/4Dsidhkiw7UVO34E4KZSvk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/UqBv2/btsIkEGdmq5/4Dsidhkiw7UVO34E4KZSvk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/UqBv2/btsIkEGdmq5/4Dsidhkiw7UVO34E4KZSvk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FUqBv2%2FbtsIkEGdmq5%2F4Dsidhkiw7UVO34E4KZSvk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;2000&quot; height=&quot;372&quot; data-origin-width=&quot;2000&quot; data-origin-height=&quot;372&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-1.&amp;nbsp; 레이블 인코딩&amp;nbsp; ::&amp;nbsp; pd.factorize()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;판다스의 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;factorize()&lt;/span&gt; 메소드로 &lt;b&gt;범주형 데이터에 숫자 라벨을 붙여서 인코딩&lt;/b&gt;할 수 있습니다.&lt;br /&gt;이 메소드는 결과를 튜플 형태로 반환하기 때문에, 아래 코드와 같이 형태를 바꿔서 새로운 칼럼으로 추가해줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719841801232&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 인코딩 결과를 새로운 칼럼으로 추가
df['airline_label'] = pd.factorize(df['airline'])[0].reshape(-1,1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1623&quot; data-origin-height=&quot;868&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/z1F0G/btsIkkurc5M/n8NpLszJTEzcMmoTBg97z0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/z1F0G/btsIkkurc5M/n8NpLszJTEzcMmoTBg97z0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/z1F0G/btsIkkurc5M/n8NpLszJTEzcMmoTBg97z0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fz1F0G%2FbtsIkkurc5M%2Fn8NpLszJTEzcMmoTBg97z0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1623&quot; height=&quot;868&quot; data-origin-width=&quot;1623&quot; data-origin-height=&quot;868&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1585&quot; data-origin-height=&quot;482&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bBGDou/btsIiPoKALM/fUBIpYJQZiNoUou1ri6Oy0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bBGDou/btsIiPoKALM/fUBIpYJQZiNoUou1ri6Oy0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bBGDou/btsIiPoKALM/fUBIpYJQZiNoUou1ri6Oy0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbBGDou%2FbtsIiPoKALM%2FfUBIpYJQZiNoUou1ri6Oy0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;614&quot; height=&quot;482&quot; data-origin-width=&quot;1585&quot; data-origin-height=&quot;482&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;범주마다 숫자라벨이 잘 붙어있지만, &lt;b&gt;알파벳 순서대로 붙여주지는 않습니다.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;그냥 데이터프레임에서 먼저 출현한 순서대로 0부터 번호를 붙여주는 방식이에요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-2.&amp;nbsp; 알파벳 순서대로 레이블 인코딩&amp;nbsp; ::&amp;nbsp; LabelEncoder()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;사이킷런(scikitlearn)의 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;LabelEncoder&lt;/span&gt; 모듈을 이용하면, &lt;b&gt;알파벳 순서대로&lt;/b&gt; 알아서 라벨링을 해줍니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719842947883&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 사이킷런 패키지의 인코더 모듈 불러오기
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()

# LabelEncoder는 원래 데이터프레임에 인코딩 결과를 붙여서 반환함
df['airline_sk_label'] = le.fit_transform(df['airline'])&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;2375&quot; data-origin-height=&quot;440&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/oVnO5/btsIj5dl1rM/IxjmfVdXGC3IIeVhuOa7gk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/oVnO5/btsIj5dl1rM/IxjmfVdXGC3IIeVhuOa7gk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/oVnO5/btsIj5dl1rM/IxjmfVdXGC3IIeVhuOa7gk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FoVnO5%2FbtsIj5dl1rM%2FIxjmfVdXGC3IIeVhuOa7gk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;2375&quot; height=&quot;440&quot; data-origin-width=&quot;2375&quot; data-origin-height=&quot;440&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1735&quot; data-origin-height=&quot;488&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/NqXOK/btsIkPt4sfs/2ArUQBZQlnP7lrdPHPnFaK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/NqXOK/btsIkPt4sfs/2ArUQBZQlnP7lrdPHPnFaK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/NqXOK/btsIkPt4sfs/2ArUQBZQlnP7lrdPHPnFaK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FNqXOK%2FbtsIkPt4sfs%2F2ArUQBZQlnP7lrdPHPnFaK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;675&quot; height=&quot;190&quot; data-origin-width=&quot;1735&quot; data-origin-height=&quot;488&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;원핫 인코딩&amp;nbsp; ::&amp;nbsp; pd.get_dummies()&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;판다스의 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;get_dummies()&lt;/span&gt; 메소드를 사용하면 빠르게 원핫인코딩을 할 수 있습니다.&lt;br /&gt;좌석클래스(class) 칼럼으로 진행해봤는데요, 원래 class 칼럼은 없어지고 class_Business, class_Economy가 생겼죠.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 기본 결과값은 True/False로 채워서 나오기 때문에, 1/0으로 채우고 싶다면 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;dtype=int&lt;/span&gt; 를 넣어줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1627&quot; data-origin-height=&quot;858&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cLpING/btsIhTyzvFE/TcaluxbSUggkO8gLEh5M2k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cLpING/btsIhTyzvFE/TcaluxbSUggkO8gLEh5M2k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cLpING/btsIhTyzvFE/TcaluxbSUggkO8gLEh5M2k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcLpING%2FbtsIhTyzvFE%2FTcaluxbSUggkO8gLEh5M2k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1627&quot; height=&quot;858&quot; data-origin-width=&quot;1627&quot; data-origin-height=&quot;858&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>label encoding</category>
      <category>onehot encoding</category>
      <category>pandas</category>
      <category>pd.factorize</category>
      <category>pd.get_dummies</category>
      <category>레이블인코딩</category>
      <category>범주형데이터 변환</category>
      <category>원핫인코딩</category>
      <category>인코딩</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/160</guid>
      <comments>https://sy-log.tistory.com/entry/Pandassklearn-%EC%9D%B8%EC%BD%94%EB%94%A9-%EC%9B%90%ED%95%AB%EC%9D%B8%EC%BD%94%EB%94%A9-%EB%B2%94%EC%A3%BC%ED%98%95%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%88%98%EC%B9%98%ED%98%95%EC%9C%BC%EB%A1%9C-%EB%B3%80%ED%99%98%ED%95%98%EA%B8%B0-pdfactorize-pdgetdummies#entry160comment</comments>
      <pubDate>Mon, 1 Jul 2024 23:53:36 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 구간화(Binning) 연속형데이터를 범주형으로 변환하기 :: pd.cut pd.qcut</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EA%B5%AC%EA%B0%84%ED%99%94Binning-%EC%97%B0%EC%86%8D%ED%98%95%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC-%EB%B2%94%EC%A3%BC%ED%98%95%EC%9C%BC%EB%A1%9C-%EB%B3%80%ED%99%98%ED%95%98%EA%B8%B0-pdcut-pdqcut</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅&amp;nbsp; 구간화 (Binning)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.7674%; height: 146px;&quot; border=&quot;1&quot; data-ke-style=&quot;style2&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;text-align: start;&quot;&gt;구간화 (Binning) &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; &lt;b&gt;연속형 수치데이터를 특정 구간으로 나눠서, 범주형 데이터로 변환하는 것.&lt;br /&gt;&lt;/b&gt; &lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; 구간화하는 이유: 이상치로 발생 가능한 문제를 줄임, 분석 결과 해석이 쉬워질 수 있음.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;pd.cut()&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; &lt;b&gt;구간값&lt;/b&gt;을 직접 입력해서 지정함.&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;pd.qcut()&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; &lt;b&gt;구간 개수&lt;/b&gt;를 입력함. 따라서 각 구간에 동일한 개수의 데이터가 들어가게 됨.&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style6&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719832199426&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/qghyO/btsIhT6mJNR/urVRsYTXI0j1unfl8bOmXK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/qghyO/btsIhT6mJNR/urVRsYTXI0j1unfl8bOmXK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/qghyO/btsIhT6mJNR/urVRsYTXI0j1unfl8bOmXK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FqghyO%2FbtsIhT6mJNR%2FurVRsYTXI0j1unfl8bOmXK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;237&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;비행시간(duration)에 따라서, 단거리/중거리/장거리 비행으로 구간화&lt;/b&gt; 하고자 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그 전에 duration 칼럼의 분포와 정보를 알아봤습니다. 5시간 미만쯤에 많이 몰려있고 30시간 이후로는 빈도가 상당히 적네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1611&quot; data-origin-height=&quot;960&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/diJhtF/btsIksMA57w/SuDkvSRWRCkZh26H2Wsg70/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/diJhtF/btsIksMA57w/SuDkvSRWRCkZh26H2Wsg70/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/diJhtF/btsIksMA57w/SuDkvSRWRCkZh26H2Wsg70/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdiJhtF%2FbtsIksMA57w%2FSuDkvSRWRCkZh26H2Wsg70%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1611&quot; height=&quot;960&quot; data-origin-width=&quot;1611&quot; data-origin-height=&quot;960&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 구간값을 정해서 구간화&amp;nbsp; ::&amp;nbsp; pd.cut()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;비행시간(duration)을 나눌 구간값을 정해서 구간화&lt;/b&gt;하여, 범주형 칼럼 'distance_cut'을 새로 생성해보겠습니다.&lt;br /&gt;단거리: 0시간 이상~5시간 미만 / 중거리: 5시간 이상~10시간 미만 / 장거리: 10시간 이상&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 코드와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;pd.cut()&lt;/span&gt; 메소드에서&lt;span style=&quot;background-color: #dddddd;&quot;&gt; bins&lt;/span&gt;로 구간값을 지정하고, 구간별 범주이름은&lt;span style=&quot;background-color: #dddddd;&quot;&gt;&amp;nbsp;labels&lt;/span&gt;로 정해주면 됩니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719833096076&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 비행시간(duration)에 따라 단/중/장거리로 구간화
df['distance_cut'] = pd.cut(
    df['duration'], 
    bins = [0, 5, 10, df['duration'].max()], 
    labels = ['short', 'medium', 'long']
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1326&quot; data-origin-height=&quot;1054&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/K4bB4/btsIk2NzaYo/A88OFhrfaM27kFpPim4ZG0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/K4bB4/btsIk2NzaYo/A88OFhrfaM27kFpPim4ZG0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/K4bB4/btsIk2NzaYo/A88OFhrfaM27kFpPim4ZG0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FK4bB4%2FbtsIk2NzaYo%2FA88OFhrfaM27kFpPim4ZG0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1326&quot; height=&quot;1054&quot; data-origin-width=&quot;1326&quot; data-origin-height=&quot;1054&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;위와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;value_counts&lt;/span&gt;로 빈도를 세보니 장거리(long)에 가장 많이 몰렸고, 중거리, 단거리로 갈수록 거의 절반씩 줄어드네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 구간 개수를 정해서 구간화&amp;nbsp; ::&amp;nbsp; pd.qcut()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이번에는 &lt;b&gt;구간 개수를 정해서 구간화&lt;/b&gt;하여, 범주형 칼럼 'distance_qcut'을 만들어 보겠습니다.&lt;br /&gt;똑같이 단거리, 중거리, 장거리 &lt;b&gt;3개&lt;/b&gt; 구간으로 나눌 거에요.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 코드와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;pd.qcut()&lt;/span&gt; 메소드를 사용하면 되는데요, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;q&lt;/span&gt;로 구간개수를 지정하고, 구간별 범주는 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;labels&lt;/span&gt;로 정해주면 됩니다.&lt;br /&gt;중복 데이터가 없다면, 구간별로 포함된 &lt;b&gt;데이터 개수가 동일&lt;/b&gt;하게 나눠질 겁니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719833802905&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 비행시간(duration)을 단/중/장거리 3개 구간으로 나누기
df['distance_qcut'] = pd.qcut(
    df['duration'],
    q = 3,
    labels = ['short', 'medium', 'long']
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1708&quot; data-origin-height=&quot;1298&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/BDem4/btsIiRUjErS/W1euHGTTCVPApCDYJrLL80/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/BDem4/btsIiRUjErS/W1euHGTTCVPApCDYJrLL80/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/BDem4/btsIiRUjErS/W1euHGTTCVPApCDYJrLL80/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FBDem4%2FbtsIiRUjErS%2FW1euHGTTCVPApCDYJrLL80%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1708&quot; height=&quot;1298&quot; data-origin-width=&quot;1708&quot; data-origin-height=&quot;1298&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;value_counts&lt;/span&gt;로 세보니, 구간마다 데이터 개수가 약 10만개로 비슷하되 똑같지는 않습니다. &lt;b&gt;중복데이터가 있었기 때문&lt;/b&gt;이에요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;구간값은 알아서 정해졌으므로, 보고 싶다면 위와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;groupby(), aggregate()&lt;/span&gt;로 min, max값들을 뽑아봐야 합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;단거리는 0~8.25시간, 중거리는 8.33~14.25시간, 장거리는 그 이상으로 나눠졌네요.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>binning</category>
      <category>pandas</category>
      <category>pd.cut</category>
      <category>pd.qcut</category>
      <category>구간화</category>
      <category>범주형데이터</category>
      <category>범주형데이터 변환</category>
      <category>연속형데이터</category>
      <category>연속형데이터 변환</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/159</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EA%B5%AC%EA%B0%84%ED%99%94Binning-%EC%97%B0%EC%86%8D%ED%98%95%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC-%EB%B2%94%EC%A3%BC%ED%98%95%EC%9C%BC%EB%A1%9C-%EB%B3%80%ED%99%98%ED%95%98%EA%B8%B0-pdcut-pdqcut#entry159comment</comments>
      <pubDate>Mon, 1 Jul 2024 20:48:27 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 이상치 확인, 이상치 처리하기 :: Z-score 방법, IQR 방법</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EC%9D%B4%EC%83%81%EC%B9%98-%ED%99%95%EC%9D%B8-%EC%9D%B4%EC%83%81%EC%B9%98-%EC%B2%98%EB%A6%AC%ED%95%98%EA%B8%B0-Z-score-%EB%B0%A9%EB%B2%95-IQR-%EB%B0%A9%EB%B2%95</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 이상치 (Outlier)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.6512%; height: 255px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 10.5269%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;text-align: start;&quot;&gt; 이상치&amp;nbsp;(Outlier) &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 46.101%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; &lt;b&gt;관측된 데이터의 일반적인 범위에서 많이 벗어난 값, 즉 너무 작은 값이나 너무 큰 값&lt;/b&gt; &lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;기준을 정해서 이상치를 처리하는 것은 필수! 이상치가 모델링 및 의사결정에 영향을 미칠 수 있기 때문.&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 10.5269%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;text-align: start;&quot;&gt;Z-score 방법&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 46.101%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;&lt;span style=&quot;background-color: #ffffff; text-align: left;&quot;&gt;&lt;b&gt;평균값&lt;/b&gt; 기반으로 이상치를 탐지하는 방법&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; 평균,&amp;nbsp;표준편차를&amp;nbsp;이용해서&amp;nbsp;&lt;b&gt;특정&amp;nbsp;데이터가&amp;nbsp;평균값으로부터&amp;nbsp;얼마나&amp;nbsp;멀리&amp;nbsp;떨어져있는지&lt;/b&gt;&amp;nbsp;계산&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;rarr; 특정 임계값을 넘어가면 이상치로 판단&lt;/span&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 10.5269%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;text-align: start;&quot;&gt;IQR 방법&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 46.101%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;text-align: start;&quot;&gt;중앙&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;background-color: #ffffff; text-align: left;&quot;&gt;&lt;b&gt;값&lt;/b&gt; 기반으로 이상치를 탐지하는 방법&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull;&lt;/span&gt;&lt;span style=&quot;text-align: start;&quot;&gt; &lt;/span&gt;사분위수,&amp;nbsp;IQR을&amp;nbsp;이용해서&lt;b&gt;&amp;nbsp;특정&amp;nbsp;데이터가&amp;nbsp;중앙값으로부터&amp;nbsp;얼마나&amp;nbsp;멀리&amp;nbsp;떨어져있는지&amp;nbsp;&lt;/b&gt;계산&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;rarr; 박스플롯의 최솟값, 최댓값을 넘어가면 이상치로 판단&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719814233982&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/d9ZB1Q/btsIjJVr5b4/o30kGpGJdmldEDtO74Xlpk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/d9ZB1Q/btsIjJVr5b4/o30kGpGJdmldEDtO74Xlpk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/d9ZB1Q/btsIjJVr5b4/o30kGpGJdmldEDtO74Xlpk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fd9ZB1Q%2FbtsIjJVr5b4%2Fo30kGpGJdmldEDtO74Xlpk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;237&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; Z-score 방법&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;Z-score 방법으로 이상치를 탐지하고 처리하는 방법은 아래와 같습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 31.8604%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(1)&amp;nbsp;각&amp;nbsp;데이터의&amp;nbsp;&lt;b&gt;Z-score&amp;nbsp;계산&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 68.1396%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터를 &lt;b&gt;표준화&lt;/b&gt;(Standardization) 즉, &lt;b&gt;평균=0 표준편차=1인 정규분포에 매핑&lt;/b&gt;시킴.&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 31.8604%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(2) Z-score가 &lt;b&gt;임계값&lt;/b&gt;을 넘어가는지 판단&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 68.1396%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;일반적으로 Z-score의 절댓값이&lt;b&gt; 2~3보다 크면&lt;/b&gt; 이상치로 판단함.&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래는 &lt;b&gt;Z-score 방법으로 이상치를 삭제하는 함수&lt;/b&gt;입니다. 임계값은 데이터 특성과 상황에 따라 정할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719814646592&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# Z-score로 이상치 탐지하고 처리하는 함수
# 입력값: 데이터프레임, 이상치 처리할 칼럼 이름, 임계값
def drop_outliers_zscore(df, column, threshold):
    
    # 각 데이터의 Z-score 계산
    z_scores = (df[column] - df[column].mean()) / df[column].std()
    
    # Z-score의 절댓값이 threshold 이하인 데이터만 남기기 (초과이면 이상치이므로 제외)
    df_drop_outliers = df[abs(z_scores) &amp;lt;= threshold]
    
    return df_drop_outliers&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼은 'price', 임계값은 3으로 두고 이상치를 제외해봤어요. 원래 데이터프레임에서 602개 행이 삭제됐습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;어떤 데이터가 삭제됐는지 한눈에 보려면 &lt;b&gt;시각화&lt;/b&gt;해보는 것이 좋습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이상치 처리 전후 각각 &lt;span style=&quot;text-align: left;&quot;&gt;&lt;b&gt;히스토그램&lt;/b&gt;을 그려보니, 약 90000 넘어가는 너무 높은 값들이 제외된 것 같네요.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1547&quot; data-origin-height=&quot;1091&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/tUOKE/btsIjyTX6tI/uynLFq8plCjJ5bqyKzym00/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/tUOKE/btsIjyTX6tI/uynLFq8plCjJ5bqyKzym00/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/tUOKE/btsIjyTX6tI/uynLFq8plCjJ5bqyKzym00/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FtUOKE%2FbtsIjyTX6tI%2FuynLFq8plCjJ5bqyKzym00%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1547&quot; height=&quot;1091&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1547&quot; data-origin-height=&quot;1091&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; IQR 방법&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;IQR 방법으로 이상치를 탐지하고 처리하는 방법은 아래와 같습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(1) &lt;b&gt;중앙값&lt;/b&gt; 관련 수치들 계산&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터의 &lt;b&gt;사분위수&lt;/b&gt;를 구하고,&lt;b&gt; IQR=제3사분위수-제1사분위수&lt;/b&gt; 를 계산함.&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(2) &lt;b&gt;임계값&lt;/b&gt;을 넘어가는 데이터 판단&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;제3사분위수 + 1.5xIQR 보다 크거나, 제1사분위수 - 1.5xIQR 보다 작으면&lt;/b&gt; 이상치로 판단함.&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;IQR 방법으로 이상치를 삭제하는 함수입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719815220289&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# IQR로 이상치 탐지하고 처리하는 함수
# 입력값: 데이터프레임, 이상치 처리할 칼럼 이름
def drop_outliers_iqr(df, column):
    
    # 1.5*IQR 계산하기
    q1 = df[column].quantile(0.25)
    q3 = df[column].quantile(0.75)
    iqr = (q3 - q1) * 1.5
    
    # 이상치 제외한 결과만 남기기
    df_drop_outliers = df[(df[column] &amp;lt;= (q3 + iqr)) &amp;amp; (df[column] &amp;gt;= (q1 - iqr))]
    
    return df_drop_outliers&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;마찬가지로 칼럼을 'price' 로 두고 이상치를 제외해봤습니다. 원래 데이터프레임에서 123개 행이 삭제됐습니다. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래와 같이&lt;b&gt; 박스플롯 상에 찍혔던 이상치들이 전부 제외&lt;/b&gt;된 것을 확인할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이상치로 판별된 데이터가 &lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;Z-score방법보다&lt;/span&gt; 적습니다. 확실히 &lt;b&gt;중앙값이 평균보다 이상치에 덜 민감&lt;/b&gt;한 모습이네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1440&quot; data-origin-height=&quot;1098&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cbrVe1/btsIiracESh/29FvSXo0DuPlX7XfmUXQL0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cbrVe1/btsIiracESh/29FvSXo0DuPlX7XfmUXQL0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cbrVe1/btsIiracESh/29FvSXo0DuPlX7XfmUXQL0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcbrVe1%2FbtsIiracESh%2F29FvSXo0DuPlX7XfmUXQL0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1440&quot; height=&quot;1098&quot; data-origin-width=&quot;1440&quot; data-origin-height=&quot;1098&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>IQR</category>
      <category>outlier</category>
      <category>pandas</category>
      <category>Z-score</category>
      <category>zscore</category>
      <category>이상치</category>
      <category>이상치 처리</category>
      <category>이상치 탐지</category>
      <category>이상치 확인</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/158</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EC%9D%B4%EC%83%81%EC%B9%98-%ED%99%95%EC%9D%B8-%EC%9D%B4%EC%83%81%EC%B9%98-%EC%B2%98%EB%A6%AC%ED%95%98%EA%B8%B0-Z-score-%EB%B0%A9%EB%B2%95-IQR-%EB%B0%A9%EB%B2%95#entry158comment</comments>
      <pubDate>Mon, 1 Jul 2024 15:41:56 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 결측치 확인, 결측치 처리 삭제 대체 :: isnull, dropna, fillna, ffill, bfill</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B2%B0%EC%B8%A1%EC%B9%98-%ED%99%95%EC%9D%B8-%EA%B2%B0%EC%B8%A1%EC%B9%98-%EC%B2%98%EB%A6%AC-%EC%82%AD%EC%A0%9C-%EB%8C%80%EC%B2%B4%ED%95%98%EA%B8%B0-isnull-dropna-fillna-ffill-bfill</link>
      <description>&lt;h3 style=&quot;text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;Pandas 데이터프레임에서 결측치 확인하고 처리해보기!&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 결측치 여부, 결측치 개수 확인하기&amp;nbsp; ::&amp;nbsp; isnull()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;isnull()&lt;/span&gt; : 데이터프레임의 값들이 &lt;b&gt;결측치인지 아닌지, 여부&lt;/b&gt;를 확인할 수 있습니다. 아래처럼 True/False로 결과가 출력됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;isnull().sum()&lt;/span&gt; :&lt;b&gt; 칼럼별로 결측치 개수&lt;/b&gt;를 출력합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719746258572&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 결측치 여부를 확인
df_na.isnull()

# 칼럼별로 결측치 개수 출력하기
df_na.isnull().sum()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1290&quot; data-origin-height=&quot;1096&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/O4dCp/btsIhWHGi7S/dkdhHz7CF4tRtUvs5zQFb1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/O4dCp/btsIhWHGi7S/dkdhHz7CF4tRtUvs5zQFb1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/O4dCp/btsIhWHGi7S/dkdhHz7CF4tRtUvs5zQFb1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FO4dCp%2FbtsIhWHGi7S%2FdkdhHz7CF4tRtUvs5zQFb1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1290&quot; height=&quot;1096&quot; data-origin-width=&quot;1290&quot; data-origin-height=&quot;1096&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-1.&amp;nbsp; 결측치 삭제 &amp;mdash; 결측치 있는 행(row) 삭제하기&amp;nbsp; ::&amp;nbsp; dropna()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;결측치가 1개라도 포함된 행이라면, 해당 행을 삭제&lt;/b&gt;해버리는 방법입니다. 결측치 비중이 적은 경우에 적합한 방법이에요.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;결측치가 많은데 삭제해버린다면, 데이터 손실이 커지고 분석모델에 원래 데이터의 특성을 반영하기 어려워지겠죠.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.dropna()&lt;/span&gt; : 데이터프레임에서 결측치가 포함된 행은 삭제합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.dropna(how='all')&lt;/span&gt; : 모든 데이터가 결측치인 행만 삭제합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719746472766&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 결측치 있는 행 삭제하기
df_na_test1 = df_na.dropna()

# 모든 데이터가 결측치인 행만 삭제하기
df_na_test2 = df_na.dropna(how = 'all')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1232&quot; data-origin-height=&quot;972&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/lzeLH/btsIizrIm3I/fEctaWnX5usXVfQE5lvgHk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/lzeLH/btsIizrIm3I/fEctaWnX5usXVfQE5lvgHk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/lzeLH/btsIizrIm3I/fEctaWnX5usXVfQE5lvgHk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FlzeLH%2FbtsIizrIm3I%2FfEctaWnX5usXVfQE5lvgHk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1232&quot; height=&quot;972&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1232&quot; data-origin-height=&quot;972&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-2.&amp;nbsp; 결측치 삭제 &amp;mdash; 결측치 많은 열(column) 삭제하기&amp;nbsp; ::&amp;nbsp; drop(axis=1)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;한 칼럼에서 결측치가 일정 비중이상으로 많으면, 해당 칼럼은 아예 삭제&lt;/b&gt;하는 방법입니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;일반적으로 결측치 비중이 50% 초과인 경우 삭제를 고려합니다. 다만 케이스에 따라 기준을 명확하게 잡고 가야겠죠.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.drop(columns = [삭제할 칼럼이름 리스트], axis=1)&lt;/span&gt; : 데이터프레임에서 특정 칼럼(들)을 삭제합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1234&quot; data-origin-height=&quot;518&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/MkcpH/btsIiiDJ05P/zNUTWeR9zYxi6ePgvHtyhK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/MkcpH/btsIiiDJ05P/zNUTWeR9zYxi6ePgvHtyhK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/MkcpH/btsIiiDJ05P/zNUTWeR9zYxi6ePgvHtyhK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FMkcpH%2FbtsIiiDJ05P%2FzNUTWeR9zYxi6ePgvHtyhK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1234&quot; height=&quot;518&quot; data-origin-width=&quot;1234&quot; data-origin-height=&quot;518&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣-1.&amp;nbsp; 결측치 대체 &lt;/b&gt;&lt;b&gt;&amp;mdash; 수치형 칼럼에서 결측치 대체하기&lt;/b&gt;&lt;b&gt;&amp;nbsp; ::&amp;nbsp; fillna()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.fillna()&lt;/span&gt; : &lt;b&gt;결측치를 특정 값으로 대체&lt;/b&gt;할 수 있습니다. 일반적으로 &lt;b&gt;평균값, 중앙값, 최빈값&lt;/b&gt; 등으로 채웁니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;대체값은 실제값이 아니므로, 너무 많은 결측치들을 같은 값으로 대체하면 편향이 생길 수 있음을 알고 진행해야 합니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;수치형 데이터 칼럼인 경우, 보통 평균값이나 중앙값으로 대체&lt;/b&gt;합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 평균값은 이상치에 민감하므로, 이상치가 적거나 없으면 &lt;b&gt;평균값&lt;/b&gt;으로 대체하면 됩니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 이상치가 많다면, 비교적 이상치에 덜 민감한 &lt;b&gt;중앙값&lt;/b&gt;으로 대체하는 것이 좋습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;duration, price 칼럼은 중앙값으로, days_left 칼럼은 평균값으로 대체해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719748593097&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 결측치 대체할 데이터프레임 따로 카피
df_fillna = df_na.copy()

# 비행시간, 가격은 중앙값으로 대체
df_fillna['duration'] = df_fillna['duration'].fillna(df_fillna['duration'].median())
df_fillna['price'] = df_fillna['price'].fillna(df_fillna['price'].median())

# 출발까지 남은일수는 평균값으로 대체
df_fillna['days_left'] = df_fillna['days_left'].fillna(df_fillna3['days_left'].mean())

# 결측치 처리 확인
df_fillna.isnull().sum()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1115&quot; data-origin-height=&quot;587&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bKvLTx/btsIhN5jm8b/RamSpooPlU9tHxZ2jfmiZ1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bKvLTx/btsIhN5jm8b/RamSpooPlU9tHxZ2jfmiZ1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bKvLTx/btsIhN5jm8b/RamSpooPlU9tHxZ2jfmiZ1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbKvLTx%2FbtsIhN5jm8b%2FRamSpooPlU9tHxZ2jfmiZ1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1115&quot; height=&quot;587&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1115&quot; data-origin-height=&quot;587&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣-2.&amp;nbsp; 결측치 대체&amp;nbsp;&lt;/b&gt;&lt;b&gt;&amp;mdash; 범주형 칼럼에서 결측치 대체하기&lt;/b&gt;&lt;b&gt;&amp;nbsp; ::&amp;nbsp; bfill(), ffill()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;범주형 데이터 칼럼인 경우, 일반적으로 최빈값 혹은 근처의 값&lt;/b&gt;들로 대체합니다.&lt;br /&gt;- df.fillna(df.mode().iloc[0]) : 최빈값으로 대체&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- df.ffill : 바로 위 행의 값으로 대체&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- df.bfill : 바로 아래 행의 값으로 대체&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719749196072&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 범주형 칼럼별 최빈값으로 결측치 대체하기
df_fillna = df_fillna.fillna(df_fillna.mode().iloc[0])

# 이전 인덱스(윗줄)에 있는 값으로 결측치 대체하기
df_fillna = df_fillna.ffill()

# 다음 인덱스(아랫줄)에 있는 값으로 결측치 대체하기
df_fillna = df_fillna.bfill()&lt;/code&gt;&lt;/pre&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>bfill</category>
      <category>dropna</category>
      <category>ffill</category>
      <category>fillna</category>
      <category>ISNULL</category>
      <category>pandas</category>
      <category>결측치</category>
      <category>결측치 대체</category>
      <category>데이터프레임 결측치</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/157</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B2%B0%EC%B8%A1%EC%B9%98-%ED%99%95%EC%9D%B8-%EA%B2%B0%EC%B8%A1%EC%B9%98-%EC%B2%98%EB%A6%AC-%EC%82%AD%EC%A0%9C-%EB%8C%80%EC%B2%B4%ED%95%98%EA%B8%B0-isnull-dropna-fillna-ffill-bfill#entry157comment</comments>
      <pubDate>Sun, 30 Jun 2024 21:17:29 +0900</pubDate>
    </item>
    <item>
      <title>[seaborn] 산점도에 회귀선 회귀식 추가하기 :: sns.lmplot sns.regplot</title>
      <link>https://sy-log.tistory.com/entry/seaborn-%EC%82%B0%EC%A0%90%EB%8F%84%EC%97%90-%ED%9A%8C%EA%B7%80%EC%84%A0-%ED%9A%8C%EA%B7%80%EC%8B%9D-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0-snslmplot-snsregplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;좌석(class) 이코노미석인 데이터셋만&lt;/b&gt; 걸러서, &lt;b&gt;비행까지 남은일수(days_left)와 가격(price)간의 관계&lt;/b&gt;를 알아보니&lt;br /&gt;&lt;b&gt;상관계수 약 -0.56로 상당한 음의 상관관계&lt;/b&gt;를 보여주고 있네요.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;산점도와 회귀선까지 시각화해서 &lt;span style=&quot;text-align: left;&quot;&gt;두 칼럼간의 &lt;/span&gt;관계를 좀더 분석해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719593558282&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')

# 좌석(class) 이코노미석인 데이터셋만 선택
df_economy = df[df['class']=='Economy']

# 비행기 출발까지 남은일수(days_left)와 가격(price)간의 상관관계 알아보기
df_economy.corr(numeric_only=True)['days_left']&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1574&quot; data-origin-height=&quot;664&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/kU7xz/btsIg1iD6pJ/d7tvfy097oRUdQkrOzK9t1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/kU7xz/btsIg1iD6pJ/d7tvfy097oRUdQkrOzK9t1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/kU7xz/btsIg1iD6pJ/d7tvfy097oRUdQkrOzK9t1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FkU7xz%2FbtsIg1iD6pJ%2Fd7tvfy097oRUdQkrOzK9t1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1574&quot; height=&quot;664&quot; data-origin-width=&quot;1574&quot; data-origin-height=&quot;664&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; sns 산점도 + 선형회귀 직선 그리기&amp;nbsp; ::&amp;nbsp; sns.lmplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;seaborn의&lt;span style=&quot;background-color: #dddddd;&quot;&gt; lmplot()&lt;/span&gt; 메소드로 &lt;b&gt;산점도와 선형회귀 직선을 함께&lt;/b&gt; 그릴 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719594523759&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# lmplot으로 산점도+회귀선 그리기
sns.lmplot(
    data = df_economy, x = 'days_left', y = 'price',               # 데이터 지정
    scatter_kws = {'color':'orange', 'alpha':0.5}, markers = '+',  # 산점도 디자인
    line_kws = {'color':'green'}                                   # 회귀선 디자인
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;730&quot; data-origin-height=&quot;739&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vjiFK/btsIihxLDR2/opnuCjFkKidv2yM46H8Fl1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vjiFK/btsIihxLDR2/opnuCjFkKidv2yM46H8Fl1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vjiFK/btsIihxLDR2/opnuCjFkKidv2yM46H8Fl1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FvjiFK%2FbtsIihxLDR2%2FopnuCjFkKidv2yM46H8Fl1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;407&quot; height=&quot;412&quot; data-origin-width=&quot;730&quot; data-origin-height=&quot;739&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;col&lt;/span&gt; 혹은 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;row&lt;/span&gt; 요소를 추가해서, 또다른 범주형 데이터를 기준으로&lt;b&gt; 분리해서 서브플롯을 여러개 그릴수&lt;/b&gt;도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래는 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;col = 'stops'&lt;/span&gt; 를 추가하여, &lt;b&gt;경유횟수에 따라 그래프를 나눠 그려본 결과&lt;/b&gt;입니다.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;경유하지 않는 경우(맨 왼쪽)은 상관관계가 비교적 약해보이는데, 경유횟수가 많아질수록 음의 상관관계가 강해지는 것 같아요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719646482261&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 경유횟수(stops)에 따라 나눠서 그래프 여러개 그리기
sns.lmplot(
    data = df_economy, x = 'days_left', y = 'price',               # 데이터 지정
    scatter_kws = {'color':'orange', 'alpha':0.5}, markers = '+',  # 산점도 디자인
    col = 'stops',                                                 # 특정 카테고리로 분리해서 서브플롯 생성
    line_kws = {'color':'green'}                                   # 회귀선 디자인
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1644&quot; data-origin-height=&quot;542&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/MUo2O/btsIhMkI3jY/1zOQgntoxHM2gr5dELm6IK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/MUo2O/btsIhMkI3jY/1zOQgntoxHM2gr5dELm6IK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/MUo2O/btsIhMkI3jY/1zOQgntoxHM2gr5dELm6IK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FMUo2O%2FbtsIhMkI3jY%2F1zOQgntoxHM2gr5dELm6IK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1644&quot; height=&quot;542&quot; data-origin-width=&quot;1644&quot; data-origin-height=&quot;542&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 선형회귀 직선에 회귀식 추가하기&amp;nbsp; ::&amp;nbsp; sns.regplot + scipy&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;회귀직선의 &lt;b&gt;회귀식&lt;/b&gt;을 알고 싶다면, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;scipy&lt;/span&gt; 패키지를 불러와서 &lt;b&gt;직선의 기울기와 절편값&lt;/b&gt;을 가져오면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;다만, 이때는 lmplot 대신 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;regplot&lt;/span&gt;으로 산점도+회귀선을 작성해야 직선의 정도들을 가져올 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;사용하는 scipy의 메소드는 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;scipy.stats.linregress()&lt;/span&gt; 입니다. 아래 코드를 참고해주세요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719648007933&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그래프 스타일 및 한글출력 설정
sns.set_theme(
    style = 'ticks',             # 그래프 배경 지정
    font = 'NanumBarunGothic',   # 한글 폰트 지정
    rc = {'axes.unicode_minus' : False}
)
# regplot으로 산점도+회귀식 그리기
regplot1 = sns.regplot(
    data = df_economy, x = 'days_left', y = 'price',          # 데이터 지정
    scatter_kws = {'color':'grey', 'alpha':0.5}, marker='+',  # 산점도 디자인
    line_kws = {'color':'red'}                                # 회귀선 디자인
)
# 회귀직선에서 기울기, 절편값 가져오기
slope, intercept, r, p, sterr = scipy.stats.linregress(
    x = regplot1.get_lines()[0].get_xdata(),
    y = regplot1.get_lines()[0].get_ydata()
)
# 그래프에 회귀식 추가 출력
plt.text(
    x = 25, y = 35000,                                            # 회귀식 출력할 위치 지정
    s = 'y = '+str(round(slope,2))+'x + '+str(round(intercept,2)) # 회귀식 구성 (소수점 둘째자리까지 반올림)
)
# 축 범위, 축 이름, 그래프 제목 지정하기
regplot1.set(
    xlabel = '출발까지 남은일수 (days_left)',
    ylabel = '가격 (price)',
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;885&quot; data-origin-height=&quot;659&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/HFqf4/btsIhO3JRQ8/jmERjOis5MmMQaVdpMvdP1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/HFqf4/btsIhO3JRQ8/jmERjOis5MmMQaVdpMvdP1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/HFqf4/btsIhO3JRQ8/jmERjOis5MmMQaVdpMvdP1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FHFqf4%2FbtsIhO3JRQ8%2FjmERjOis5MmMQaVdpMvdP1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;554&quot; height=&quot;413&quot; data-origin-width=&quot;885&quot; data-origin-height=&quot;659&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>scipy</category>
      <category>seaborn</category>
      <category>sns.lmplot</category>
      <category>sns.regplot</category>
      <category>산점도</category>
      <category>상관관계</category>
      <category>상관분석</category>
      <category>회귀분석</category>
      <category>회귀선</category>
      <category>회귀식</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/156</guid>
      <comments>https://sy-log.tistory.com/entry/seaborn-%EC%82%B0%EC%A0%90%EB%8F%84%EC%97%90-%ED%9A%8C%EA%B7%80%EC%84%A0-%ED%9A%8C%EA%B7%80%EC%8B%9D-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0-snslmplot-snsregplot#entry156comment</comments>
      <pubDate>Sat, 29 Jun 2024 17:12:50 +0900</pubDate>
    </item>
    <item>
      <title>[seaborn] 데이터프레임으로 히트맵 그리기 :: sns.heatmap</title>
      <link>https://sy-log.tistory.com/entry/seaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%ED%9E%88%ED%8A%B8%EB%A7%B5-%EA%B7%B8%EB%A6%AC%EA%B8%B0-snsheatmap</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 히트맵 (heatmap)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 81px;&quot; border=&quot;1&quot; data-ke-style=&quot;style6&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 68.7209%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;히트맵 (Heatmap)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 31.1628%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;seaborn 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 59px;&quot;&gt;
&lt;td style=&quot;width: 68.7209%; height: 59px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull; 데이터를 카테고리(범주)별로 나눠서 색상으로 표현한 행렬&lt;br /&gt;&lt;span style=&quot;background-color: #f5f7f5; text-align: start;&quot;&gt;&amp;bull; 여러 카테고리 값의 변화를 한눈에 살펴보기 좋은 시각화 도구임&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 31.1628%; height: 59px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;sns.heatmap()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style6&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719587315443&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/eid4Or/btsIgCDeqKH/mZ1KOayzsSzR2ecEtihwvk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/eid4Or/btsIgCDeqKH/mZ1KOayzsSzR2ecEtihwvk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/eid4Or/btsIgCDeqKH/mZ1KOayzsSzR2ecEtihwvk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Feid4Or%2FbtsIgCDeqKH%2FmZ1KOayzsSzR2ecEtihwvk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;237&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; sns 히트맵 그리기&amp;nbsp; ::&amp;nbsp; sns.heatmap&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;클래스(class)가 이코노미석&lt;/b&gt;인 경우만 걸러서, 이 데이터셋에서 &lt;b&gt;수치데이터인 칼럼들 간의 상관계수&lt;/b&gt;를 히트맵으로 작성할게요.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터프레임에 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;corr()&lt;/span&gt; 메소드를 사용해서 상관계수를 전부 도출할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;히트맵 색상과 수치로 상관관계를 한눈에 파악할 수 있네요.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;비행시간(duration)과 가격(price)간의 상관계수는 0.29로 약한 상관관계를 가지고 있고,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;비행까지 남은일수(days_left)과 가격(price)간의 상관계수는 -0.56으로 음의 상관관계를 보여주고 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719587500322&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 이코노미석인 경우만 걸러서 데이터셋 생성
df_economy = df[df['class']=='Economy']

# 상관계수 행렬을 히트맵으로 작성
sns.heatmap(
    data = df_economy.corr(numeric_only=True),  # 수치칼럼 간 상관계수 도출
    annot = True,                               # 상관계수 수치 표시
    cmap='coolwarm'                             # 컬러맵 지정
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;792&quot; data-origin-height=&quot;628&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/He1tv/btsIgEgMWCt/B2VlkpvekU7lWX0Lx4YZ21/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/He1tv/btsIgEgMWCt/B2VlkpvekU7lWX0Lx4YZ21/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/He1tv/btsIgEgMWCt/B2VlkpvekU7lWX0Lx4YZ21/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FHe1tv%2FbtsIgEgMWCt%2FB2VlkpvekU7lWX0Lx4YZ21%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;468&quot; height=&quot;371&quot; data-origin-width=&quot;792&quot; data-origin-height=&quot;628&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 교차표(crosstab)로 sns 히트맵 그리기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;출발도시(source_city)와 도착도시(destination_city)를 데이터셋을 나누는 범주로 놓고, &lt;br /&gt;&lt;b&gt;각 범주마다 평균 가격&lt;/b&gt;을 뽑아보겠습니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;pd.crosstab()&lt;/span&gt; 메소드로 &lt;b&gt;교차표&lt;/b&gt;를 작성해서 뽑을 수 있습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이 교차표를 그대로 넣어서 히트맵을 그려볼게요. &lt;br /&gt;컬러맵과 수치까지 보이게 작성해서, &lt;b&gt;출발-도착도시에 따라 가격이 어떻게 다른지 한눈에 파악&lt;/b&gt;할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719587682399&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 크로스테이블 작성: 출발도시-도착도시 간 평균가격 
crosstab1 = pd.crosstab(
    index = df['source_city'],
    columns = df['destination_city'], 
    values = df['price'], aggfunc = 'mean'
)

# 그래프 스타일 및 한글출력 설정
sns.set_theme(
    style = 'ticks',             # 그래프 배경 지정
    font = 'NanumBarunGothic',   # 한글 폰트 지정
    rc = {'axes.unicode_minus' : False}
)
# 히트맵 생성
heatmap1 = sns.heatmap(
    data = crosstab1,                       # 크로스테이블을 데이터로 지정
    cmap = 'Blues', cbar = True,            # 컬러맵 지정 및 컬러바 표시
    linecolor = 'white', linewidths = 0.5,  # 테두리 색상 및 두께 지정
    annot = True, fmt='.0f'                 # 수치 표시방식 지정
)
# x축 위에 표시하기
heatmap1.xaxis.tick_top()

# 축 범위, 축 이름, 그래프 제목 지정하기
heatmap1.set(
    xlabel = '도착도시 (destination_city)',
    ylabel = '출발도시 (source_city)',
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;944&quot; data-origin-height=&quot;659&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bgmtum/btsIhzFzZq1/aQezYNIADTbGnhKhh9aqi0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bgmtum/btsIhzFzZq1/aQezYNIADTbGnhKhh9aqi0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bgmtum/btsIhzFzZq1/aQezYNIADTbGnhKhh9aqi0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbgmtum%2FbtsIhzFzZq1%2FaQezYNIADTbGnhKhh9aqi0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;653&quot; height=&quot;456&quot; data-origin-width=&quot;944&quot; data-origin-height=&quot;659&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>Heatmap</category>
      <category>pd.crosstab</category>
      <category>Python</category>
      <category>seaborn</category>
      <category>sns.heatmap</category>
      <category>교차표</category>
      <category>데이터프레임 히트맵</category>
      <category>크로스테이블</category>
      <category>파이썬</category>
      <category>히트맵</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/155</guid>
      <comments>https://sy-log.tistory.com/entry/seaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%ED%9E%88%ED%8A%B8%EB%A7%B5-%EA%B7%B8%EB%A6%AC%EA%B8%B0-snsheatmap#entry155comment</comments>
      <pubDate>Sat, 29 Jun 2024 00:36:37 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib][seaborn] 데이터프레임으로 산점도 그리기 :: plt.scatter sns.scatterplot</title>
      <link>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EC%82%B0%EC%A0%90%EB%8F%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltscatter-snsscatterplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 산점도 (Scatter plot)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style6&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center; width: 56.2791%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;산점도&amp;nbsp;(Scatter&amp;nbsp;plot)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 22.4419%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 21.1628%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;seaborn 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 56.2791%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull;연속형 변수 2개 사이의 관계를 점으로 찍어서 표현하는 그래프&lt;br /&gt;&lt;span style=&quot;background-color: #f5f7f5; text-align: start;&quot;&gt;&amp;bull;산점도의 형태를 보고 상관관계를 가늠할 수 있&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #f5f7f5; text-align: start;&quot;&gt;&amp;bull;산점도의 점 하나하나는 관측값을 나타냄&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 22.4419%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;plt.scatter()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 21.1628%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;sns.scatterplot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;비행시간(duration)과 비행편 가격(price)간의 관계를 산점도로 찍어서 알아보려고 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719507347821&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/QHUnX/btsIfXlHYxr/8QPtP5bCywmSEFniFIWkM0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/QHUnX/btsIfXlHYxr/8QPtP5bCywmSEFniFIWkM0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/QHUnX/btsIfXlHYxr/8QPtP5bCywmSEFniFIWkM0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FQHUnX%2FbtsIfXlHYxr%2F8QPtP5bCywmSEFniFIWkM0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;237&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; plt 산점도 그리기&amp;nbsp; ::&amp;nbsp; plt.scatter&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;산점도 생성: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.scatter(x='x축 들어갈 칼럼', y='y축 들어갈 칼럼')&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;간단하게 2개 칼럼만 넣어서 산점도를 그려볼 수 있습니다. 형태를 보아하니, 아주 약간&amp;nbsp;양의 상관관계를 가진 것 같습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719507470455&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 산점도 그리기: 비행시간-가격
plt.scatter(x=df['duration'], y=df['price'])

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1630&quot; data-origin-height=&quot;767&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bfKxQM/btsIeHErLaA/UreTq8iaqHY1F3v8Yt6YNk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bfKxQM/btsIeHErLaA/UreTq8iaqHY1F3v8Yt6YNk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bfKxQM/btsIeHErLaA/UreTq8iaqHY1F3v8Yt6YNk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbfKxQM%2FbtsIeHErLaA%2FUreTq8iaqHY1F3v8Yt6YNk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;666&quot; height=&quot;313&quot; data-origin-width=&quot;1630&quot; data-origin-height=&quot;767&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; sns 산점도 그리기&amp;nbsp; ::&amp;nbsp; sns.scatterplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;seaborn으로 산점도를 그리면 보다 다양한 요소를 추가할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;2개 칼럼 간의 관계 뿐만 아니라, 그 안에서 또 &lt;b&gt;구분할 카테고리를 추가&lt;/b&gt;할 수 있습니다.&lt;br /&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;hue(색상)&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;style(점 모양)&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sizes(점 크기)&lt;/span&gt;로 카테고리가 구분되어 보이도록 지정할 수 있어요.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 코드에선 hue(색상)으로 &lt;b&gt;좌석클래스(class)가 구분되어 보이도록&lt;/b&gt; 지정해봤습니다.&lt;br /&gt;비즈니스, 이코노미 둘다 비행시간-가격 간에 약한 양의 상관관계를 가진 것 같아 보입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719507550434&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그래프 스타일 및 한글출력 설정
sns.set_theme(
    style = 'whitegrid',                   # 그래프 배경 지정
    font = 'NanumBarunGothic',             # 한글 폰트 지정
    rc = {'axes.unicode_minus' : False}
)
scatter = sns.scatterplot(
    data=df, x='duration', y='price',  # 데이터 지정
    hue='class',                       # 색상으로 구분할 카테고리 변수
    alpha=0.5, palette='Set2'          # 투명도 및 팔레트 지정
)
# 축 범위, 축 이름, 그래프 제목 지정하기
scatter.set(
    xlabel = '비행시간 (duration)',
    ylabel = '가격 (price)',
    title = '좌석클래스별 비행시간-가격 산점도'
)
# x축 간격 지정하기
scatter.set_xticks(np.arange(0,50,5))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1636&quot; data-origin-height=&quot;818&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bWEv0S/btsIeUKgYK0/q2oP2rMtKtxiujKDRzUf8k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bWEv0S/btsIeUKgYK0/q2oP2rMtKtxiujKDRzUf8k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bWEv0S/btsIeUKgYK0/q2oP2rMtKtxiujKDRzUf8k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbWEv0S%2FbtsIeUKgYK0%2Fq2oP2rMtKtxiujKDRzUf8k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1636&quot; height=&quot;818&quot; data-origin-width=&quot;1636&quot; data-origin-height=&quot;818&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>plt.scatter</category>
      <category>Python</category>
      <category>scatter</category>
      <category>scatterplot</category>
      <category>seaborn</category>
      <category>sns.scatterplot</category>
      <category>데이터프레임 산점도</category>
      <category>산점도</category>
      <category>파이썬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/154</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EC%82%B0%EC%A0%90%EB%8F%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltscatter-snsscatterplot#entry154comment</comments>
      <pubDate>Fri, 28 Jun 2024 02:18:55 +0900</pubDate>
    </item>
    <item>
      <title>[seaborn] 데이터프레임으로 박스플롯 그리기 :: sns.boxplot</title>
      <link>https://sy-log.tistory.com/entry/seaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EB%B0%95%EC%8A%A4%ED%94%8C%EB%A1%AF-%EA%B7%B8%EB%A6%AC%EA%B8%B0-snsboxplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 박스플롯 (Box plot)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 189px;&quot; border=&quot;1&quot; data-ke-style=&quot;style6&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 61.0465%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;박스플롯 (Box plot)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 19.4186%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 19.4187%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;seaborn 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 167px;&quot;&gt;
&lt;td style=&quot;width: 61.0465%; height: 167px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull;&lt;b&gt;중앙값을 포함한 사분위수를 시각화하는 통계분석 도구&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull;박스플롯으로 볼 수 있는 통계량&lt;br /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp;- 제1사분위수(25%), 중앙값(50%), 제3사분위수(75%)&lt;br /&gt;&amp;nbsp; &amp;nbsp;- IQR (InterQuartile Range) = 제3사분위수 - 제1사분위수&lt;br /&gt;&amp;nbsp; &amp;nbsp;- 최솟값 = 제1사분위수 - 1.5*IQR 보다 큰 값들 중 최솟값&lt;br /&gt;&amp;nbsp; &amp;nbsp;- 최댓값 = 제3사분위수 + 1.5*IQR 보다 작은 값들 중 최댓값&lt;br /&gt;&amp;nbsp; &amp;nbsp;- 이상치 = 위 최댓값과 최솟값을 넘어가는 값들&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 19.4186%; height: 167px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;plt.boxplot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 19.4187%; height: 167px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;sns.boxplot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style6&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719490473565&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/J2n60/btsIfJul4vL/NlU2EcuBqjuvAlRDLHa3iK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/J2n60/btsIfJul4vL/NlU2EcuBqjuvAlRDLHa3iK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/J2n60/btsIfJul4vL/NlU2EcuBqjuvAlRDLHa3iK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJ2n60%2FbtsIfJul4vL%2FNlU2EcuBqjuvAlRDLHa3iK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;237&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;237&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; sns 박스플롯 그리기&amp;nbsp; ::&amp;nbsp; sns.boxplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;박스플롯 생성: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.boxplot(data=데이터프레임, x=범주, y=수치)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719491025819&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 박스플롯 생성
sns.boxplot(data=df, x='arrival_time', y='price')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1621&quot; data-origin-height=&quot;800&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dd6uzg/btsIfJ2aG3u/qIb1g7LpZW5cn9B3mW1IBK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dd6uzg/btsIfJ2aG3u/qIb1g7LpZW5cn9B3mW1IBK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dd6uzg/btsIfJ2aG3u/qIb1g7LpZW5cn9B3mW1IBK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fdd6uzg%2FbtsIfJ2aG3u%2FqIb1g7LpZW5cn9B3mW1IBK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1621&quot; height=&quot;800&quot; data-origin-width=&quot;1621&quot; data-origin-height=&quot;800&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;박스플롯을 보니 시간대별로 &lt;b&gt;최솟값, 제1사분위수, 중앙값은 크게 차이나지 않고 비슷한 편&lt;/b&gt;이네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;이른아침과 심야 비행편이 눈에 띄게 낮은 가격대&lt;/b&gt;에 분포하고 있습니다. 제3사분위수가 다른 시간대에 비해 상당히 낮네요.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래와 같이 평균값을 도출해봐도 꽤 낮은 가격입니다. 다만 박스플롯에서 보이듯이 높은 가격의 이상치도 많습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1242&quot; data-origin-height=&quot;434&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/D2Ydz/btsIeiY5oct/PeMjs0Nq2ZKVNtOtTOpCAK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/D2Ydz/btsIeiY5oct/PeMjs0Nq2ZKVNtOtTOpCAK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/D2Ydz/btsIeiY5oct/PeMjs0Nq2ZKVNtOtTOpCAK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FD2Ydz%2FbtsIeiY5oct%2FPeMjs0Nq2ZKVNtOtTOpCAK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;831&quot; height=&quot;290&quot; data-origin-width=&quot;1242&quot; data-origin-height=&quot;434&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 박스플롯 커스터마이징&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span&gt;&lt;b&gt;아래와 같이 다양한 요소로 박스플롯의 디자인요소를 커스텀할 수 있습니다.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span&gt;&lt;b&gt;boxplot 생성 시 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;hue&lt;/span&gt; 요소를 추가하여, 분류할 카테고리 변수를 추가할 수도 있습니다.&lt;/b&gt;&lt;/span&gt;&lt;span&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719492093775&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그래프 스타일 및 한글출력 설정
sns.set_theme(
    style = 'whitegrid',                   # 그래프 배경 지정
    font = 'NanumBarunGothic',             # 한글 폰트 지정
    rc = {'figure.figsize' : (12,6),       # 그래프 크기 지정
          'axes.unicode_minus' : False}
)
# 박스플롯 생성
boxplot = sns.boxplot(
    data=df, x='arrival_time', y='price',  # 데이터 지정 
    hue='class',                           # 색상으로 구분할 카테고리 변수 
    width=.5,                              # 박스 두께
    fliersize = 2,                         # 이상치 점 크기
    palette=plt.cm.Set3.colors             # 색상 팔레트 지정
)
# 축 범위, 축 이름, 그래프 제목 지정하기
boxplot.set(
    xlabel = '출발시간 (arrival_time)',
    ylabel = '가격 (price)',
    title = '출발시간에 따른 좌석별 가격 박스플롯'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1633&quot; data-origin-height=&quot;832&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/t5kF7/btsId74wFb9/IYZwpOzLvrwyYCdCFWIlYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/t5kF7/btsId74wFb9/IYZwpOzLvrwyYCdCFWIlYK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/t5kF7/btsId74wFb9/IYZwpOzLvrwyYCdCFWIlYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Ft5kF7%2FbtsId74wFb9%2FIYZwpOzLvrwyYCdCFWIlYK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1633&quot; height=&quot;832&quot; data-origin-width=&quot;1633&quot; data-origin-height=&quot;832&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;출발시간에서 &lt;b&gt;좌석클래스&lt;/b&gt;로 한번더 카테고리를 나누고 보니&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;이코노미석&lt;/b&gt;은 시간대별로 차이가 그렇게 크지 않고, 분포도 넓지 않은 편입니다.&lt;br /&gt;그에 비하면 &lt;b&gt;비즈니스석&lt;/b&gt;은 시간대에 따라 차이가 약간 있는 편이고, 가격 분포가 상당히 넓습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;위에서 좌석을 나누기 전에는 &lt;b&gt;이른아침과 심야시간&lt;/b&gt;&amp;nbsp;가격대가 낮고, 높은 이상치가 많은 편이었는데&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;이렇게 나누고 보니 높은 이상치는 비즈니스석 가격이었던 것 같네요.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>boxplot</category>
      <category>Python</category>
      <category>seaborn</category>
      <category>sns.boxplot</category>
      <category>박스플롯</category>
      <category>사분위수</category>
      <category>중앙값</category>
      <category>파이썬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/153</guid>
      <comments>https://sy-log.tistory.com/entry/seaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EB%B0%95%EC%8A%A4%ED%94%8C%EB%A1%AF-%EA%B7%B8%EB%A6%AC%EA%B8%B0-snsboxplot#entry153comment</comments>
      <pubDate>Thu, 27 Jun 2024 22:37:19 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib][seaborn] 데이터프레임으로 히스토그램 그리기 :: plt.hist sns.histplot</title>
      <link>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%ED%9E%88%EC%8A%A4%ED%86%A0%EA%B7%B8%EB%9E%A8-%EA%B7%B8%EB%A6%AC%EA%B8%B0-plthist-snshistplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 히스토그램&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 100px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style6&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 58.2558%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;히스토그램 (Histogram)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 21.7442%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 19.8837%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;seaborn 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 78px;&quot;&gt;
&lt;td style=&quot;width: 58.2558%; height: 78px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull;데이터의 빈도수 및 분포를 알아보기 위해 작성하는 그래프&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull;카테고리별 개수를 막대로 나타내는 막대그래프와 달리, &lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;b&gt;정해진 구간별 빈도수&lt;/b&gt;를 막대로 나타내어 분포를 볼 수 있는 통계분석 도구임&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 21.7442%; height: 78px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;plt.hist()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 19.8837%; height: 78px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;sns.histplot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719470188777&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1495&quot; data-origin-height=&quot;277&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b9f21t/btsId8u7pwr/nmZbOuWacev55K2p5kTiw1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b9f21t/btsId8u7pwr/nmZbOuWacev55K2p5kTiw1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b9f21t/btsId8u7pwr/nmZbOuWacev55K2p5kTiw1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb9f21t%2FbtsId8u7pwr%2FnmZbOuWacev55K2p5kTiw1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1495&quot; height=&quot;277&quot; data-origin-width=&quot;1495&quot; data-origin-height=&quot;277&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-1.&amp;nbsp; plt 히스토그램 그리기&amp;nbsp; ::&amp;nbsp; plt.hist&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;히스토그램 생성: plt.hist(데이터셋)&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;간단하게 데이터셋만 넣어줘도, 구간은 자동으로 정해져서 생성됩니다. &lt;br /&gt;그냥 생성해봤더니 10개로 나눠졌네요. 아래에서 구간개수를 좀더 늘려보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719470409081&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 히스토그램 그리기 : duration(비행시간)의 빈도수 및 분포
plt.hist(df['duration'])

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;859&quot; data-origin-height=&quot;625&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/7sL7b/btsIdOX0yS1/sn45WdJQ2F54O1I1ePRR90/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/7sL7b/btsIdOX0yS1/sn45WdJQ2F54O1I1ePRR90/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/7sL7b/btsIdOX0yS1/sn45WdJQ2F54O1I1ePRR90/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7sL7b%2FbtsIdOX0yS1%2Fsn45WdJQ2F54O1I1ePRR90%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;441&quot; height=&quot;321&quot; data-origin-width=&quot;859&quot; data-origin-height=&quot;625&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-2.&amp;nbsp; plt 히스토그램 커스터마이징&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;계급 개수 지정: plt.hist(x=데이터셋, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;bins=계급개수&lt;/span&gt;, ...)&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;x,y축 간격 지정: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.xticks(범위)&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.yticks(범위)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;구간별 빈도수 및 구간 출력: 히스토그램을 변수 하나에 저장하고, 해당 변수 출력하기 (아래 코드에서 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;histogram&lt;/span&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719470787196&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 차트에서 한글 표시하기
plt.rcParams['font.family'] = &quot;NanumBarunGothic&quot;
plt.rcParams['axes.unicode_minus'] = False

# 눈금선 추가하기
plt.grid(linewidth = '0.5')

# 히스토그램 생성하기
histogram = plt.hist(
    x = df['duration'],  # 데이터 지정
    bins = 20,           # 계급을 20개 구간으로 나눔
    color = 'salmon'     # 색상 지정
)

# x,y축 간격 지정하기
plt.xticks(np.arange(0,50,5))
plt.yticks(np.arange(0,45000,5000))

# x,y축 이름 정하기
plt.xlabel('비행 시간 (duration)')
plt.ylabel('비행편 개수 (flights)')

# 차트 표시하기
plt.show()

# 구간별 빈도수, 구간 확인하기
histogram&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1507&quot; data-origin-height=&quot;939&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cv9pHa/btsIfuX4qtW/RgD0iKEWr0SK7Qr2SrtxA0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cv9pHa/btsIfuX4qtW/RgD0iKEWr0SK7Qr2SrtxA0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cv9pHa/btsIfuX4qtW/RgD0iKEWr0SK7Qr2SrtxA0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcv9pHa%2FbtsIfuX4qtW%2FRgD0iKEWr0SK7Qr2SrtxA0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1507&quot; height=&quot;939&quot; data-origin-width=&quot;1507&quot; data-origin-height=&quot;939&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;계급구간을 20개로 나눠서 그려봤는데요, 구간 10개일 때 뭉뚱그려져 있던 데이터 분포를 더 상세하게 볼 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;생각보다 비행시간 3시간 이하 구간에 많이 몰려있었고, 긴 비행 중에서는 22~25시간이 비교적 많은 편이었네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣.&amp;nbsp; sns 히스토그램 그리기&amp;nbsp; ::&amp;nbsp; sns.histplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;seaborn으로 히스토그램을 그리면, 보다 다양한 요소들을 커스텀할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래처럼 구간 범위를 직접 지정할 수 있고, KDE(커널밀도 추정지) 그래프를 추가할 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719476633082&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그래프 크기 및 한글출력 설정
sns.set_theme(
    style = 'ticks',
    font = 'NanumBarunGothic',
    rc = {'figure.figsize' : (12,6),
          'axes.unicode_minus' : False}
)
# 히스토그램 생성
histogram1 = sns.histplot(
    data=df, x='duration',      # 데이터 지정
    bins=20, binrange=(0,50),   # 계급 개수 20개, 범위는 0~50으로 지정
    kde=True,                   # 커널 밀도 그래프 추가
    color='darkorange'          # 색상 지정
)
# 축 범위, 축 이름, 그래프 제목 지정하기
histogram1.set(
    xlabel = '비행시간 (duration)',
    ylabel = '도수 (count)',
    title = '비행시간 히스토그램'
)
# y축 눈금 설정하기
histogram1.set_xticks(np.arange(0,50,5))

# 계급구간별 도수 표시하기
for i in histogram1.containers:
    histogram1.bar_label(i, fontsize=9)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1640&quot; data-origin-height=&quot;1463&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6kPsH/btsIfW02Ikf/XPgUeO3N8HpTTW7yMdDoK1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6kPsH/btsIfW02Ikf/XPgUeO3N8HpTTW7yMdDoK1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6kPsH/btsIfW02Ikf/XPgUeO3N8HpTTW7yMdDoK1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6kPsH%2FbtsIfW02Ikf%2FXPgUeO3N8HpTTW7yMdDoK1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1640&quot; height=&quot;1463&quot; data-origin-width=&quot;1640&quot; data-origin-height=&quot;1463&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>histogram</category>
      <category>matplotlib</category>
      <category>plt.hist</category>
      <category>Python</category>
      <category>seaborn</category>
      <category>sns.histplot</category>
      <category>데이터프레임 시각화</category>
      <category>데이터프레임 히스토그램</category>
      <category>파이썬</category>
      <category>히스토그램</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/152</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%ED%9E%88%EC%8A%A4%ED%86%A0%EA%B7%B8%EB%9E%A8-%EA%B7%B8%EB%A6%AC%EA%B8%B0-plthist-snshistplot#entry152comment</comments>
      <pubDate>Thu, 27 Jun 2024 17:28:25 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib] plt colors 컬러이름 모음, 컬러이름 출력하기 :: mcolors</title>
      <link>https://sy-log.tistory.com/entry/matplotlib-plt-colors-%EC%BB%AC%EB%9F%AC%EC%9D%B4%EB%A6%84-%EB%AA%A8%EC%9D%8C-%EC%BB%AC%EB%9F%AC%EC%9D%B4%EB%A6%84-%EC%B6%9C%EB%A0%A5%ED%95%98%EA%B8%B0-mcolors</link>
      <description>&lt;h3 style=&quot;text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib (plt) 컬러이름 모음, 쓸 수 있는 컬러이름 출력해보기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style5&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;pre id=&quot;code_1719473903059&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# mcolors 모듈 불러오기
import matplotlib.colors as mcolors

# 기본컬러 이름 및 RGB출력 (8가지)
mcolors.BASE_COLORS

# Tableau컬러 이름 및 컬러코드 출력 (10가지)
mcolors.TABLEAU_COLORS

# CSS컬러 이름 및 컬러코드출력 (148가지)
mcolors.cnames
# 혹은 mcolors.CSS4_COLORS

# XKCD컬러 이름 및 컬러코드 출력 (949가지)
mcolors.XKCD_COLORS&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;mcolors 모듈을 가져오고, 위 코드를 실행하면 아래와 같이 이름 및 컬러코드가 출력됩니다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1059&quot; data-origin-height=&quot;773&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/leWoC/btsIftdTCDy/5SNh0TJld0jx0SWbNhHrx1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/leWoC/btsIftdTCDy/5SNh0TJld0jx0SWbNhHrx1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/leWoC/btsIftdTCDy/5SNh0TJld0jx0SWbNhHrx1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FleWoC%2FbtsIftdTCDy%2F5SNh0TJld0jx0SWbNhHrx1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;669&quot; height=&quot;773&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1059&quot; data-origin-height=&quot;773&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;아래는 matplotlib 공식 문서에서 가져온 컬러 일람표입니다.&lt;br /&gt;(&lt;a href=&quot;https://matplotlib.org/stable/gallery/color/named_colors.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://matplotlib.org/stable/gallery/color/named_colors.html&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 119px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 87px;&quot;&gt;
&lt;td style=&quot;width: 24.5348%; height: 87px; text-align: center;&quot;&gt;&lt;b&gt;BASE_COLORS&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.4652%; height: 87px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1031&quot; data-origin-height=&quot;140&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b4ig1M/btsIfjvO900/GsApMuDJTWKWZNuyAc4oEK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b4ig1M/btsIfjvO900/GsApMuDJTWKWZNuyAc4oEK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b4ig1M/btsIfjvO900/GsApMuDJTWKWZNuyAc4oEK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb4ig1M%2FbtsIfjvO900%2FGsApMuDJTWKWZNuyAc4oEK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;551&quot; height=&quot;75&quot; data-origin-width=&quot;1031&quot; data-origin-height=&quot;140&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 16px;&quot;&gt;
&lt;td style=&quot;width: 24.5348%; height: 16px; text-align: center;&quot;&gt;&lt;b&gt;TABLEAU_COLORS&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.4652%; height: 16px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;700&quot; data-origin-height=&quot;209&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/uNIXf/btsIdR1A2nm/FOAZ6ueTSaK3T1T2NVFXOk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/uNIXf/btsIdR1A2nm/FOAZ6ueTSaK3T1T2NVFXOk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/uNIXf/btsIdR1A2nm/FOAZ6ueTSaK3T1T2NVFXOk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FuNIXf%2FbtsIdR1A2nm%2FFOAZ6ueTSaK3T1T2NVFXOk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;391&quot; height=&quot;117&quot; data-origin-width=&quot;700&quot; data-origin-height=&quot;209&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 16px;&quot;&gt;
&lt;td style=&quot;width: 24.5348%; height: 16px; text-align: center;&quot;&gt;&lt;b&gt;CSS4_COLORS&lt;/b&gt;&lt;/td&gt;
&lt;td style=&quot;width: 75.4652%; height: 16px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1362&quot; data-origin-height=&quot;1309&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ZGMcb/btsId31VZGx/o34aKkkkTcABWIA1nBFTmk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ZGMcb/btsId31VZGx/o34aKkkkTcABWIA1nBFTmk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ZGMcb/btsId31VZGx/o34aKkkkTcABWIA1nBFTmk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FZGMcb%2FbtsId31VZGx%2Fo34aKkkkTcABWIA1nBFTmk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1362&quot; height=&quot;1309&quot; data-origin-width=&quot;1362&quot; data-origin-height=&quot;1309&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>mcolors</category>
      <category>plt</category>
      <category>plt color</category>
      <category>plt colors</category>
      <category>plt palette</category>
      <category>Python</category>
      <category>seaborn</category>
      <category>파이썬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/151</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlib-plt-colors-%EC%BB%AC%EB%9F%AC%EC%9D%B4%EB%A6%84-%EB%AA%A8%EC%9D%8C-%EC%BB%AC%EB%9F%AC%EC%9D%B4%EB%A6%84-%EC%B6%9C%EB%A0%A5%ED%95%98%EA%B8%B0-mcolors#entry151comment</comments>
      <pubDate>Thu, 27 Jun 2024 16:48:26 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib] 데이터프레임으로 파이차트 원형그래프 그리기 :: plt.pie</title>
      <link>https://sy-log.tistory.com/entry/matplotlib-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%ED%8C%8C%EC%9D%B4%EC%B0%A8%ED%8A%B8-%EC%9B%90%ED%98%95%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltpie</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 파이차트 (원형그래프)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 78px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style6&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 22px;&quot;&gt;
&lt;td style=&quot;text-align: center; width: 50.6977%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;파이차트, 원형그래프 (Pie Chart)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 26.1628%; height: 22px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 56px;&quot;&gt;
&lt;td style=&quot;width: 50.6977%; height: 56px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull;전체(100%) 대비 각 범주의 비율(%)을 한눈에 파악하기 쉬움&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull;전체 대비 각 부분부분의 비율을 비교하기 좋음&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 26.1628%; height: 56px;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;plt.pie()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;departure_time(출발시간)별로 비행편 비율이 어떻게 다른지&lt;/b&gt; 알고 싶은데요, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;value_counts&lt;/span&gt; 메소드로 출발시간별로 카운트한 다음, &lt;/span&gt;한눈에 파악할 수 있도록 파이차트를 그려보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719418921477&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)

# departure_time(출발시간) 별로 비행편 카운트
dt_counts = pd.DataFrame(df['departure_time'].value_counts(ascending=True))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1306&quot; data-origin-height=&quot;486&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/L3PR1/btsIeD1Kbn1/k3cYcGtfqwnDiF1RzbIrrK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/L3PR1/btsIeD1Kbn1/k3cYcGtfqwnDiF1RzbIrrK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/L3PR1/btsIeD1Kbn1/k3cYcGtfqwnDiF1RzbIrrK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FL3PR1%2FbtsIeD1Kbn1%2Fk3cYcGtfqwnDiF1RzbIrrK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1306&quot; height=&quot;486&quot; data-origin-width=&quot;1306&quot; data-origin-height=&quot;486&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; plt 파이차트 그리기&amp;nbsp; ::&amp;nbsp; plt.pie&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;파이차트 생성: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.pie(x = 수치데이터, labels = 범주데이터, autopct = 수치표시 방식)&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719419216103&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 파이그래프 그리기
plt.pie(
    x = dt_counts['count'],    # 수치데이터 지정
    labels = dt_counts.index,  # 카테고리 표시
    autopct = '%.1f%%'         # 데이터 라벨(숫자) 표시방식
)

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;722&quot; data-origin-height=&quot;570&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bdG1Ko/btsIeU3ePd0/WXVvIGYsU1jMd4UWGPRwSk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bdG1Ko/btsIeU3ePd0/WXVvIGYsU1jMd4UWGPRwSk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bdG1Ko/btsIeU3ePd0/WXVvIGYsU1jMd4UWGPRwSk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbdG1Ko%2FbtsIeU3ePd0%2FWXVvIGYsU1jMd4UWGPRwSk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;408&quot; height=&quot;322&quot; data-origin-width=&quot;722&quot; data-origin-height=&quot;570&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 파이차트 커스터마이징&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;아래와 같이 다양한 요소로 부채꼴의 모양, 위치, 테두리 등등을 커스텀할 수 있습니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719419640140&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 파이그래프 그리기
plt.pie(
    x = dt_counts,                  # 데이터 지정
    labels = dt_counts.index,       # 카테고리 표시
    labeldistance = 1.1,            # 카테고리 표시위치 지정
    autopct = '%.1f%%',             # 수치데이터 표시방식
    startangle = 90,                # 시작각도 설정 (시계반대방향)
    explode = [0, 0, 0, 0, 0, 0.1], # 중심에서 벗어나는 정도
    wedgeprops = {
        'width': 0.7,               # 부채꼴 길이
        'edgecolor': 'w',           # 부재꼴 테두리 컬러
        'linewidth': 0.5},          # 부채꼴 테두리 두
    colors = plt.cm.Set2.colors     # 컬러맵 지정
)

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;693&quot; data-origin-height=&quot;559&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vzgz8/btsIeFFdeAw/uz7K84p8twPHOI3HGV7cYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vzgz8/btsIeFFdeAw/uz7K84p8twPHOI3HGV7cYK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vzgz8/btsIeFFdeAw/uz7K84p8twPHOI3HGV7cYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fvzgz8%2FbtsIeFFdeAw%2Fuz7K84p8twPHOI3HGV7cYK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;428&quot; height=&quot;345&quot; data-origin-width=&quot;693&quot; data-origin-height=&quot;559&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>pie chart</category>
      <category>plt.pie</category>
      <category>Python</category>
      <category>원형그래프</category>
      <category>원형차트</category>
      <category>파이그래프</category>
      <category>파이썬</category>
      <category>파이차트</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/150</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlib-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%ED%8C%8C%EC%9D%B4%EC%B0%A8%ED%8A%B8-%EC%9B%90%ED%98%95%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltpie#entry150comment</comments>
      <pubDate>Thu, 27 Jun 2024 01:38:38 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib] plt 컬러맵 확인하기 :: plt.colormaps plt.cm</title>
      <link>https://sy-log.tistory.com/entry/matplotlib-plt-%EC%BB%AC%EB%9F%AC%EB%A7%B5-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0-pltcolormaps-pltcm</link>
      <description>&lt;h3 data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅ plt 패키지에서 기본제공하는 컬러맵 확인하기&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.colormaps&lt;/span&gt;로 모든 컬러맵 이름을 확인할 수 있고, 실제 색상은 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.cm&lt;/span&gt;으로 출력해볼 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719409993696&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import matplotlib.pyplot as plt

# 컬러맵 전부 출력
list(plt.colormaps)

# 컬러맵 하나 골라서 색상 확인
plt.cm.Set2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1021&quot; data-origin-height=&quot;893&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bn1ecv/btsIcOX7eat/Za86sK3q3ngtIzWtOrdXVk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bn1ecv/btsIcOX7eat/Za86sK3q3ngtIzWtOrdXVk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bn1ecv/btsIcOX7eat/Za86sK3q3ngtIzWtOrdXVk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbn1ecv%2FbtsIcOX7eat%2FZa86sK3q3ngtIzWtOrdXVk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1021&quot; height=&quot;893&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1021&quot; data-origin-height=&quot;893&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>plt</category>
      <category>plt 색상</category>
      <category>plt 컬러맵</category>
      <category>plt.cm</category>
      <category>plt.colormaps</category>
      <category>Python</category>
      <category>파이썬</category>
      <category>파이썬 시각화</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/149</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlib-plt-%EC%BB%AC%EB%9F%AC%EB%A7%B5-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0-pltcolormaps-pltcm#entry149comment</comments>
      <pubDate>Wed, 26 Jun 2024 22:58:03 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib][seaborn] 데이터프레임으로 막대그래프 그리기 :: plt.bar sns.barplot</title>
      <link>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EB%A7%89%EB%8C%80%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltbar-snsbarplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 막대 그래프 (바 그래프)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-style=&quot;style6&quot; data-ke-align=&quot;alignLeft&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: center; width: 50.2326%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;선 그래프 (Line Plot)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 24.7675%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 24.8837%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;seaborn 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50.2326%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull;범주/카테고리에 따른 수량과 통계량을 살펴보기에 적합함&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull;범주별 수치를 한눈에 대소비교 하기에 좋음&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 24.7675%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;plt.bar()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center; width: 24.8837%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; background-color: #dddddd; color: #000000;&quot;&gt;&lt;b&gt;sns.barplot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style6&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;airline(비행편)에 따라 price(티켓가격) 평균이 어떻게 달라지는지, 막대 그래프&lt;/b&gt;로 살펴보고자 합니다.&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;groupby&lt;/span&gt; 메소드로 평균값 데이터셋을 만든 다음&lt;/b&gt; 시각화를 진행해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719320991301&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)

# airline(비행편)별 price(티켓가격) 평균값
airline_price = df.groupby(by='airline').mean(numeric_only=True)[['price']]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1259&quot; data-origin-height=&quot;489&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bE9x5b/btsIbTxOsfj/77RxWw9v0KhsdfqkfwFUG1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bE9x5b/btsIbTxOsfj/77RxWw9v0KhsdfqkfwFUG1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bE9x5b/btsIbTxOsfj/77RxWw9v0KhsdfqkfwFUG1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbE9x5b%2FbtsIbTxOsfj%2F77RxWw9v0KhsdfqkfwFUG1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1259&quot; height=&quot;489&quot; data-origin-width=&quot;1259&quot; data-origin-height=&quot;489&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; plt 막대 그래프 그리기&amp;nbsp; ::&amp;nbsp; plt.bar&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;막대그래프 생성: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.bar(x=범주데이터, height=범주별 수치데이터)&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터라벨 표시: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.text()&lt;/span&gt; 활용 (아래 코드 참조)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;눈금선 표시: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.grid(True)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;x,y축 이름 표시하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.xlabel('x축 이름')&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.ylabel('y축 이름')&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1719321648825&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 차트에서 한글 표시하기
plt.rcParams['font.family'] = &quot;NanumBarunGothic&quot;
plt.rcParams['axes.unicode_minus'] = False

# 막대그래프 그리기
plt.bar(
    x = airline_price.index,         # x축 = 범주
    height = airline_price['price'], # y축 = 막대 높이 = 범주별 수치
    color = 'c', edgecolor = 'k'     # 막대, 테두리 색상 설정
)
# 데이터 라벨 표시하기
for i in range(len(airline_price)):
    plt.text(
        x = airline_price.index[i],               # 라벨 위치 x축
        y = airline_price['price'][i],            # 라벨 위치 y축
        s = np.round(airline_price['price'][i]),  # 표시할 데이터 (반올림)
        ha='center')                              # 막대 가운데 표시
    
# 눈금선 표시하기
plt.grid(True, 
    linewidth = 1, linestyle = ':'   # 눈금선 두께, 스타일 설정
)
# x,y축 이름 정하기
plt.xlabel('비행사 (airline)', labelpad = 10)
plt.ylabel('티켓가격 (price)', labelpad = 10)

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;904&quot; data-origin-height=&quot;652&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/blFhfK/btsIcpb2JVO/7UbLqamsKoNjuP5WUTwvYk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/blFhfK/btsIcpb2JVO/7UbLqamsKoNjuP5WUTwvYk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/blFhfK/btsIcpb2JVO/7UbLqamsKoNjuP5WUTwvYk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FblFhfK%2FbtsIcpb2JVO%2F7UbLqamsKoNjuP5WUTwvYk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;520&quot; height=&quot;375&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;904&quot; data-origin-height=&quot;652&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;Air_India와 Vistara의 가격만 특히 높습니다. 비행사만 기준으로 나눠서 보니 데이터가 이렇게 쏠려서 보이는 것 같아요.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;좌석클래스 별로도 한번더 나눠서&lt;/b&gt; 막대그래프를 다시 그려보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; sns 막대 그래프 그리기&amp;nbsp; ::&amp;nbsp; sns.barplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그래프 배경, 팔레트, 폰트 등 스타일 지정: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.set_theme()&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;막대그래프 생성: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.barplot(data=데이터프레임, x=범주데이터, y=범주별 수치데이터, hue=색상으로 구분할 범주)&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;범례 위치 지정: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.move_legend(barplot, '범례 위치')&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터라벨 표시: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;barplot.bar_label()&lt;/span&gt; 활용 (아래 코드 참조)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719327178879&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그래프 스타일 지정
sns.set_theme(
    style='whitegrid',
    palette='muted',
    font='NanumBarunGothic',
    rc = {'figure.figsize' : (12,6),
          'axes.unicode_minus' : False}
)
# 막대그래프 그리기
barplot1 = sns.barplot(data=df, x='airline', y='price', hue='class')

# 축 범위, 축 이름, 그래프 제목 지정하기
barplot1.set(
    xlabel = '비행사 (airline)',
    ylabel = '티켓 가격 (price)',
    title = '비행사별 좌석에 따른 평균 티켓가격'
)
# y축 눈금 설정하기
barplot1.set_yticks(np.arange(0,55000,5000))

# 범례 위치 지정하기
sns.move_legend(barplot1, 'upper left')

# 데이터 라벨 표시하기
for i in barplot1.containers:
    barplot1.bar_label(i, fontsize=10)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1579&quot; data-origin-height=&quot;832&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/LLQDu/btsIbl9jnV0/tKmsGE97tqkjoyrkFjIUnK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/LLQDu/btsIbl9jnV0/tKmsGE97tqkjoyrkFjIUnK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/LLQDu/btsIbl9jnV0/tKmsGE97tqkjoyrkFjIUnK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLLQDu%2FbtsIbl9jnV0%2FtKmsGE97tqkjoyrkFjIUnK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1579&quot; height=&quot;832&quot; data-origin-width=&quot;1579&quot; data-origin-height=&quot;832&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예상한대로 &lt;b&gt;비즈니스석&lt;/b&gt; 때문에 Air_India, Vistara 2개 비행사만 티켓가격 평균이 특히 높은 거였네요!&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;비즈니스석을 제외해도.. 이 2개 비행사의 이코노미석 가격도 다른 비행사들에 비해 비싼 편인 것을 알 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>plt.bar</category>
      <category>Python</category>
      <category>seaborn</category>
      <category>sns.barplot</category>
      <category>데이터프레임 시각화</category>
      <category>막대그래프</category>
      <category>바그래프</category>
      <category>파이썬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/148</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EB%A7%89%EB%8C%80%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltbar-snsbarplot#entry148comment</comments>
      <pubDate>Wed, 26 Jun 2024 00:22:11 +0900</pubDate>
    </item>
    <item>
      <title>[seaborn] 그래프 스타일 지정하기 :: set_style() set_context() set_palette() set_theme()</title>
      <link>https://sy-log.tistory.com/entry/seaborn-%EA%B7%B8%EB%9E%98%ED%94%84-%EC%8A%A4%ED%83%80%EC%9D%BC-%EC%A7%80%EC%A0%95%ED%95%98%EA%B8%B0-setstyle-setcontext-setpalette-settheme</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 배경과 눈금선 스타일&amp;nbsp; ::&amp;nbsp; set_style()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;set_style()&lt;/span&gt; 메소드로 &lt;span style=&quot;color: #006dd7;&quot;&gt;white, whitegrid, dark, darkgrid, ticks&lt;/span&gt; 5가지 중 그래프 스타일을 정할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;스타일에 따라 아래와 같이 배경색이나 눈금선, 축 디자인이 달라집니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719292210329&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# sns 내장 데이터셋
df = sns.load_dataset('penguins')

sns.set_style('스타일 이름')
sns.boxplot(data=df, x='species', y='body_mass_g')&lt;/code&gt;&lt;/pre&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style9&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'white'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'whitegrid'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'dark'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'darkgrid'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'ticks'&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;855&quot; data-origin-height=&quot;638&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/zY16U/btsIa641vl6/AmIrk2xchM5eRX7U9aC4o0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/zY16U/btsIa641vl6/AmIrk2xchM5eRX7U9aC4o0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/zY16U/btsIa641vl6/AmIrk2xchM5eRX7U9aC4o0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FzY16U%2FbtsIa641vl6%2FAmIrk2xchM5eRX7U9aC4o0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;855&quot; height=&quot;638&quot; data-origin-width=&quot;855&quot; data-origin-height=&quot;638&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;848&quot; data-origin-height=&quot;633&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sdErR/btsIa3AtnW6/axtkmIZDYTcDZdCbNRSW0k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sdErR/btsIa3AtnW6/axtkmIZDYTcDZdCbNRSW0k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sdErR/btsIa3AtnW6/axtkmIZDYTcDZdCbNRSW0k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsdErR%2FbtsIa3AtnW6%2FaxtkmIZDYTcDZdCbNRSW0k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;848&quot; height=&quot;633&quot; data-origin-width=&quot;848&quot; data-origin-height=&quot;633&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;855&quot; data-origin-height=&quot;635&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/k1Yi6/btsIa3Hiygg/x7YVYA1Nd9vGncLGvbpkd0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/k1Yi6/btsIa3Hiygg/x7YVYA1Nd9vGncLGvbpkd0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/k1Yi6/btsIa3Hiygg/x7YVYA1Nd9vGncLGvbpkd0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fk1Yi6%2FbtsIa3Hiygg%2Fx7YVYA1Nd9vGncLGvbpkd0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;855&quot; height=&quot;635&quot; data-origin-width=&quot;855&quot; data-origin-height=&quot;635&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;855&quot; data-origin-height=&quot;637&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/r7U4u/btsIbtFMrXk/WOznpKbPtEXXORI44Dhht1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/r7U4u/btsIbtFMrXk/WOznpKbPtEXXORI44Dhht1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/r7U4u/btsIbtFMrXk/WOznpKbPtEXXORI44Dhht1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fr7U4u%2FbtsIbtFMrXk%2FWOznpKbPtEXXORI44Dhht1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;855&quot; height=&quot;637&quot; data-origin-width=&quot;855&quot; data-origin-height=&quot;637&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;856&quot; data-origin-height=&quot;634&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bD1dzq/btsIaQ9hH9l/pTjcX9MzwirYjnO8mdKkz0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bD1dzq/btsIaQ9hH9l/pTjcX9MzwirYjnO8mdKkz0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bD1dzq/btsIaQ9hH9l/pTjcX9MzwirYjnO8mdKkz0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbD1dzq%2FbtsIaQ9hH9l%2FpTjcX9MzwirYjnO8mdKkz0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;856&quot; height=&quot;634&quot; data-origin-width=&quot;856&quot; data-origin-height=&quot;634&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 텍스트와 테두리 스케일&amp;nbsp; ::&amp;nbsp; set_context()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;그래프 용도에 알맞는 스케일로 알아서 바꿔줍니다. &lt;span style=&quot;color: #006dd7;&quot;&gt;paper, notebook, talk, poster&lt;/span&gt; 4가지가 제공되고 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719292982040&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;sns.set_context('용도 이름')
sns.boxplot(data=df, x='species', y='body_mass_g')&lt;/code&gt;&lt;/pre&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 48px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style9&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 16px;&quot;&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'paper'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'notebook'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'talk'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'poster'&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 16px;&quot;&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;논문 등 출판물용 작은 크기&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;주피터노트북용 일반적인 크기&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;프레젠테이션 등을 위한 큰 크기&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;포스터 등을 위한 가장 큰 크기&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 16px;&quot;&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;851&quot; data-origin-height=&quot;635&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cjEXKM/btsIbuRUPGw/q0MFeL1HOUKEpprKLUiWJ1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cjEXKM/btsIbuRUPGw/q0MFeL1HOUKEpprKLUiWJ1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cjEXKM/btsIbuRUPGw/q0MFeL1HOUKEpprKLUiWJ1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcjEXKM%2FbtsIbuRUPGw%2Fq0MFeL1HOUKEpprKLUiWJ1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;851&quot; height=&quot;635&quot; data-origin-width=&quot;851&quot; data-origin-height=&quot;635&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;864&quot; data-origin-height=&quot;640&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cSg02T/btsIb5ElOZ3/bbA4f4dtIGwXqwpDk2Lx5K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cSg02T/btsIb5ElOZ3/bbA4f4dtIGwXqwpDk2Lx5K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cSg02T/btsIb5ElOZ3/bbA4f4dtIGwXqwpDk2Lx5K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcSg02T%2FbtsIb5ElOZ3%2FbbA4f4dtIGwXqwpDk2Lx5K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;864&quot; height=&quot;640&quot; data-origin-width=&quot;864&quot; data-origin-height=&quot;640&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;917&quot; data-origin-height=&quot;676&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/DcFDi/btsIcBW4cJO/tpQ1Po92yrI0LUKFyOCY6K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/DcFDi/btsIcBW4cJO/tpQ1Po92yrI0LUKFyOCY6K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/DcFDi/btsIcBW4cJO/tpQ1Po92yrI0LUKFyOCY6K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FDcFDi%2FbtsIcBW4cJO%2FtpQ1Po92yrI0LUKFyOCY6K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;917&quot; height=&quot;676&quot; data-origin-width=&quot;917&quot; data-origin-height=&quot;676&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 25%; text-align: center; height: 16px;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;967&quot; data-origin-height=&quot;690&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/PfRzC/btsIakbLXbm/kkdM8zszyZXiyYohtgkock/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/PfRzC/btsIakbLXbm/kkdM8zszyZXiyYohtgkock/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/PfRzC/btsIakbLXbm/kkdM8zszyZXiyYohtgkock/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FPfRzC%2FbtsIakbLXbm%2FkkdM8zszyZXiyYohtgkock%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;967&quot; height=&quot;690&quot; data-origin-width=&quot;967&quot; data-origin-height=&quot;690&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 색상 팔레트&amp;nbsp; ::&amp;nbsp; set_palette()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;seaborn에서 기본 제공하는 색상 팔레트는 아래 10가지 색상입니다.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #006dd7;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #006dd7;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;set_palette()&lt;/span&gt; 메소드를 사용해서&lt;/span&gt; deep, muted, pastel, dark, bright, colorblind&lt;/span&gt; 6가지 팔레트를 설정할 수 있습니다.&lt;br /&gt;기본 팔레트에서 색상 톤이 조금씩 달라져요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1659&quot; data-origin-height=&quot;146&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/BiSqJ/btsIcBpGZAb/t7b2xKDGKJIuq8Mb4eYZk1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/BiSqJ/btsIcBpGZAb/t7b2xKDGKJIuq8Mb4eYZk1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/BiSqJ/btsIcBpGZAb/t7b2xKDGKJIuq8Mb4eYZk1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FBiSqJ%2FbtsIcBpGZAb%2Ft7b2xKDGKJIuq8Mb4eYZk1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1659&quot; height=&quot;146&quot; data-origin-width=&quot;1659&quot; data-origin-height=&quot;146&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;pre id=&quot;code_1719302625341&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;sns.set_palette(palette='팔레트 이름')
sns.boxplot(data=df, x='species', y='body_mass_g', hue='species')&lt;/code&gt;&lt;/pre&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style9&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'deep'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'muted'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'pastel'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'dark'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'bright'&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;'colorblind'&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;869&quot; data-origin-height=&quot;643&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b74cXQ/btsIa6Yz25I/plJ51SgqHg0sUbLQ6bnK9k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b74cXQ/btsIa6Yz25I/plJ51SgqHg0sUbLQ6bnK9k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b74cXQ/btsIa6Yz25I/plJ51SgqHg0sUbLQ6bnK9k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb74cXQ%2FbtsIa6Yz25I%2FplJ51SgqHg0sUbLQ6bnK9k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;869&quot; height=&quot;643&quot; data-origin-width=&quot;869&quot; data-origin-height=&quot;643&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;862&quot; data-origin-height=&quot;639&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/4SkBZ/btsIcSEEudt/lU60QNxoxvrKec0UqBiBY1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/4SkBZ/btsIcSEEudt/lU60QNxoxvrKec0UqBiBY1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/4SkBZ/btsIcSEEudt/lU60QNxoxvrKec0UqBiBY1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F4SkBZ%2FbtsIcSEEudt%2FlU60QNxoxvrKec0UqBiBY1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;862&quot; height=&quot;639&quot; data-origin-width=&quot;862&quot; data-origin-height=&quot;639&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;863&quot; data-origin-height=&quot;646&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/FxyNM/btsIbSyEUAu/fUCNqqo9k5INvXqks3zWn1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/FxyNM/btsIbSyEUAu/fUCNqqo9k5INvXqks3zWn1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/FxyNM/btsIbSyEUAu/fUCNqqo9k5INvXqks3zWn1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFxyNM%2FbtsIbSyEUAu%2FfUCNqqo9k5INvXqks3zWn1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;863&quot; height=&quot;646&quot; data-origin-width=&quot;863&quot; data-origin-height=&quot;646&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;873&quot; data-origin-height=&quot;644&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bAMYCw/btsIcgMOxCQ/8Ck5kBJZff4qQCCSJKr1Gk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bAMYCw/btsIcgMOxCQ/8Ck5kBJZff4qQCCSJKr1Gk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bAMYCw/btsIcgMOxCQ/8Ck5kBJZff4qQCCSJKr1Gk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbAMYCw%2FbtsIcgMOxCQ%2F8Ck5kBJZff4qQCCSJKr1Gk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;873&quot; height=&quot;644&quot; data-origin-width=&quot;873&quot; data-origin-height=&quot;644&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;883&quot; data-origin-height=&quot;642&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bCscIs/btsIbHYolRx/F4AwG7zxfiYLV8C9K5XlY1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bCscIs/btsIbHYolRx/F4AwG7zxfiYLV8C9K5XlY1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bCscIs/btsIbHYolRx/F4AwG7zxfiYLV8C9K5XlY1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbCscIs%2FbtsIbHYolRx%2FF4AwG7zxfiYLV8C9K5XlY1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;883&quot; height=&quot;642&quot; data-origin-width=&quot;883&quot; data-origin-height=&quot;642&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;td style=&quot;width: 16.6667%; text-align: center;&quot;&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;869&quot; data-origin-height=&quot;644&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/DNEfI/btsIa4zHBDR/xhja2s0k1rKa0yxh8Yco31/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/DNEfI/btsIa4zHBDR/xhja2s0k1rKa0yxh8Yco31/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/DNEfI/btsIa4zHBDR/xhja2s0k1rKa0yxh8Yco31/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FDNEfI%2FbtsIa4zHBDR%2Fxhja2s0k1rKa0yxh8Yco31%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;869&quot; height=&quot;644&quot; data-origin-width=&quot;869&quot; data-origin-height=&quot;644&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;seaborn에서 제공하는 팔레트가 2가지 더 있습니다. &lt;span style=&quot;color: #006dd7;&quot;&gt;hls, husl&lt;/span&gt; 은 아래와 같이 6가지 색상을 제공합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;또는 직접 색상코드를 넣어서 팔레트를 만들 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1655&quot; data-origin-height=&quot;142&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/lw4z6/btsIcXTjflM/WUezo1ACBdPPp0jVTzqRf0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/lw4z6/btsIcXTjflM/WUezo1ACBdPPp0jVTzqRf0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/lw4z6/btsIcXTjflM/WUezo1ACBdPPp0jVTzqRf0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Flw4z6%2FbtsIcXTjflM%2FWUezo1ACBdPPp0jVTzqRf0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1655&quot; height=&quot;142&quot; data-origin-width=&quot;1655&quot; data-origin-height=&quot;142&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1668&quot; data-origin-height=&quot;146&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/caZO0W/btsIb4eH1FT/bC8kKCkSYT1LgUpsXgMjb0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/caZO0W/btsIb4eH1FT/bC8kKCkSYT1LgUpsXgMjb0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/caZO0W/btsIb4eH1FT/bC8kKCkSYT1LgUpsXgMjb0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcaZO0W%2FbtsIb4eH1FT%2FbC8kKCkSYT1LgUpsXgMjb0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1668&quot; height=&quot;146&quot; data-origin-width=&quot;1668&quot; data-origin-height=&quot;146&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣&amp;nbsp; 스타일 한번에 설정하기&amp;nbsp; ::&amp;nbsp; set_theme()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;위의 배경, 눈금선, 스케일, 팔레트, 폰트 등을 한번에 설정할 수 있는 메소드가 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;set_theme()&lt;/span&gt; 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래와 같이 요소요소들을 넣어서 스타일 테마를 설정할 수 있습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;설정할 수 있는 요소들: &lt;span style=&quot;color: #006dd7;&quot;&gt;context, style, palette, font, font_scale, color_codes, rc&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719305084804&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;sns.set_theme(
    context='notebook',
    style='whitegrid',
    palette='muted',
    font='serif'
)
sns.boxplot(data=df, x='species', y='body_mass_g', hue='species')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignLeft&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;888&quot; data-origin-height=&quot;666&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/7lEwE/btsIdbjHT9k/kun8WLr6EpAEf2vCj7IZsK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/7lEwE/btsIdbjHT9k/kun8WLr6EpAEf2vCj7IZsK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/7lEwE/btsIdbjHT9k/kun8WLr6EpAEf2vCj7IZsK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F7lEwE%2FbtsIdbjHT9k%2Fkun8WLr6EpAEf2vCj7IZsK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;469&quot; height=&quot;352&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;888&quot; data-origin-height=&quot;666&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>Python</category>
      <category>seaborn</category>
      <category>set_context</category>
      <category>set_palette</category>
      <category>set_style</category>
      <category>set_theme</category>
      <category>데이터프레임 시각화</category>
      <category>시각화</category>
      <category>파이썬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/147</guid>
      <comments>https://sy-log.tistory.com/entry/seaborn-%EA%B7%B8%EB%9E%98%ED%94%84-%EC%8A%A4%ED%83%80%EC%9D%BC-%EC%A7%80%EC%A0%95%ED%95%98%EA%B8%B0-setstyle-setcontext-setpalette-settheme#entry147comment</comments>
      <pubDate>Tue, 25 Jun 2024 19:36:02 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib][seaborn] 데이터프레임으로 선그래프 그리기 :: plt.plot sns.lineplot</title>
      <link>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EC%84%A0%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltplot-snslineplot</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅ 선 그래프&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style6&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 43.1007%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;선 그래프 (Line Plot)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 28.7984%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;matplotlib 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 28.1008%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;seaborn 메소드&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 43.1007%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: start;&quot;&gt; &amp;bull;시간, 순서에 따른 변화를 살펴보기에 적합함&lt;br /&gt;&lt;span style=&quot;text-align: start;&quot;&gt;&amp;bull;데이터의 증감을 파악할 수 있음&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 28.7984%; text-align: center;&quot;&gt;&lt;span style=&quot;background-color: #dddddd; color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;plt.plot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 28.1008%; text-align: center;&quot;&gt;&lt;span style=&quot;background-color: #dddddd; color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;sns.lineplot()&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 패키지 &amp;amp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 입니다.&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;days_left(출발까지 남은일수)에 따른 평균 price(티켓가격)의 변화를 선 그래프&lt;/b&gt;로 살펴보고자 합니다.&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;groupby&lt;/span&gt; 메소드로 평균값 데이터셋을 만든 다음&lt;/b&gt; 시각화를 진행해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719228790144&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 패키지 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop([df.columns[0]], axis=1)

# days_left(출발까지 남은일수)에 따른 평균 price(티켓가격)의 변화
days_price = df.groupby(by='days_left').mean(numeric_only=True)[['price']]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1351&quot; data-origin-height=&quot;425&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cLQ14o/btsIbppdUU8/HHLf0w6lCPkHePE1cHdpoK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cLQ14o/btsIbppdUU8/HHLf0w6lCPkHePE1cHdpoK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cLQ14o/btsIbppdUU8/HHLf0w6lCPkHePE1cHdpoK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcLQ14o%2FbtsIbppdUU8%2FHHLf0w6lCPkHePE1cHdpoK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1351&quot; height=&quot;425&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1351&quot; data-origin-height=&quot;425&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1361&quot; data-origin-height=&quot;589&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/FNruh/btsIaF0imX7/8LMSAZujq7uIiBNOOTIpQk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/FNruh/btsIaF0imX7/8LMSAZujq7uIiBNOOTIpQk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/FNruh/btsIaF0imX7/8LMSAZujq7uIiBNOOTIpQk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFNruh%2FbtsIaF0imX7%2F8LMSAZujq7uIiBNOOTIpQk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1361&quot; height=&quot;589&quot; data-origin-width=&quot;1361&quot; data-origin-height=&quot;589&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-1.&amp;nbsp; plt 선 그래프 그리기&amp;nbsp; ::&amp;nbsp; plt.plot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;plt로 그래프를 그리는 단계는 기본적으로 &lt;span style=&quot;color: #006dd7;&quot;&gt;&lt;b&gt;차트 영역 지정하기 &amp;rarr; 시각화 &amp;rarr; 차트 표시하기&lt;/b&gt;&lt;/span&gt; 순서입니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;plt.plot()에 &lt;b&gt;데이터프레임&lt;/b&gt;만 넣어주면, 인덱스는 x축, 칼럼 값들은 y축으로 알아서 들어갑니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719229850717&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure()

# 선 그래프 그리기
plt.plot(days_price)

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1302&quot; data-origin-height=&quot;612&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dRlXEG/btsIbgMNEvs/zQz57kB5dWNlOlEifq3edK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dRlXEG/btsIbgMNEvs/zQz57kB5dWNlOlEifq3edK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dRlXEG/btsIbgMNEvs/zQz57kB5dWNlOlEifq3edK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdRlXEG%2FbtsIbgMNEvs%2FzQz57kB5dWNlOlEifq3edK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;696&quot; height=&quot;327&quot; data-origin-width=&quot;1302&quot; data-origin-height=&quot;612&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-2.&amp;nbsp; plt 커스터마이징 해보기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt; 차트 크기 바꾸기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.figure(figsize=(너비,높이))&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;차트 눈금선 표시하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.grid(True)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;제목 표시하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.title('제목')&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;x,y축 범위 바꾸기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.xlim(최솟값,최댓값)&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.ylim(최솟값,최댓값)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;x,y축&amp;nbsp;눈금&amp;nbsp;바꾸기:&amp;nbsp;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.xticks(범위)&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.yticks(범위)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;x,y축 이름 표시하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.xlabel('x축 이름')&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.ylabel('y축 이름') &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719230290314&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 차트 영역 지정하기
plt.figure(figsize=(12,6))

# 선 그래프 그리기
plt.plot(
    days_price,                    # 데이터 지정
    color = 'c', linewidth = 3,    # 선 색상, 두께 설정
    marker = '.', markersize = 10  # 마커 모양, 크기 설정
)
# y축 범위 변경하기
plt.ylim(0, 35000)

# x축 눈금 설정하기
plt.xticks(np.arange(0,50,5))

# 눈금선 표시하기
plt.grid(True, 
    linewidth = 1, linestyle = ':'  # 눈금선 두께, 스타일 설정
)
# 제목 표시하기
title = {'fontsize':'14', 'fontweight':'bold'}
plt.title(
    '출발까지 남은일수에 따른 평균 티켓가격의 변화', 
    fontdict = title,  # 글꼴 설정
    pad = 10           # 그래프와 간격 설정
)
# x,y축 이름 표시하기
plt.xlabel('출발까지 남은일수 (days_left)')
plt.ylabel('티켓 가격 (price)')

# 차트 표시하기
plt.show()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1596&quot; data-origin-height=&quot;835&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vkCTk/btsH9ikLKbG/kiCRpzkQLHDD0iLZPhdvN1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vkCTk/btsH9ikLKbG/kiCRpzkQLHDD0iLZPhdvN1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vkCTk/btsH9ikLKbG/kiCRpzkQLHDD0iLZPhdvN1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FvkCTk%2FbtsH9ikLKbG%2FkiCRpzkQLHDD0iLZPhdvN1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1596&quot; height=&quot;835&quot; data-origin-width=&quot;1596&quot; data-origin-height=&quot;835&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-1.&amp;nbsp; sns 선 그래프 그리기&amp;nbsp; ::&amp;nbsp; sns.lineplot&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;plt로 그리려면 평균값을 계산한 데이터셋을 따로 만들어야 했습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;반면 sns는 따로 만들 필요없이.. &lt;b&gt;원래 데이터셋 그대로 넣어도 평균값을 알아서 계산해서 그려줍니다!&lt;/b&gt;&lt;br /&gt;이런 점에서 plt보다 통계적인 강점이 있다는 거죠. 선 그래프에 표시된 &lt;b&gt;음영은 95%신뢰구간을 자동으로 표시&lt;/b&gt;해준 거에요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719233012669&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;sns.lineplot(
    data = df,
    x = 'days_left', y = 'price'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1318&quot; data-origin-height=&quot;692&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/oFwCB/btsIbIB589B/IKV7nFLeKKAu9alREmbGy0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/oFwCB/btsIbIB589B/IKV7nFLeKKAu9alREmbGy0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/oFwCB/btsIbIB589B/IKV7nFLeKKAu9alREmbGy0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FoFwCB%2FbtsIbIB589B%2FIKV7nFLeKKAu9alREmbGy0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;751&quot; height=&quot;394&quot; data-origin-width=&quot;1318&quot; data-origin-height=&quot;692&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-2.&amp;nbsp; sns 커스터마이징 해보기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래 sns 메소드를 활용해도 되고, 위에서 썼던 plt 메소드를 그대로 써도 문제 없이 적용됩니다.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;그래프 테마 설정하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.set_theme(style='테마이름')&lt;/span&gt; &lt;span style=&quot;color: #006dd7;&quot;&gt;(테마종류: &lt;span style=&quot;background-color: #ffffff; text-align: left;&quot;&gt;&quot;white&quot;, &quot;dark&quot;, &quot;&lt;/span&gt;whitegrid&lt;span style=&quot;background-color: #ffffff; text-align: left;&quot;&gt;&quot;, &quot;&lt;/span&gt;darkgrid&lt;span style=&quot;background-color: #ffffff; text-align: left;&quot;&gt;&quot;, &quot;&lt;/span&gt;ticks&lt;span style=&quot;background-color: #ffffff; text-align: left;&quot;&gt;&quot;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;그래프 크기, 한글폰트 설정하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;sns.set(font='폰트이름', rc={딕셔너리 형태로 설정})&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;제목 표시하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;lineplot.set(title='제목')&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;x,y축 범위 바꾸기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;lineplot.set(xlim = (최솟값,최댓값), ylim = (최솟값,최댓값))&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;x,y축 이름 표시하기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;lineplot.set(xlabel = 'x축 이름', ylabel = 'y축 이름')&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;x,y축 눈금 바꾸기: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;lineplot.set_xticks(범위)&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;lineplot.set_yticks(범위)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1719245776728&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그래프 테마 설정하기
sns.set_theme(
    style = 'darkgrid'
)
# 그래프 크기, 폰트 설정하기
sns.set(
    font = 'NanumBarunGothic',
    rc = {'figure.figsize' : (12,6), 
          'axes.unicode_minus' : False}
)
# 선 그래프 그리기
lineplot = sns.lineplot(
    data = df, x = 'days_left', y = 'price', 
    color = 'green', linewidth = 3
)
# 축 범위, 축 이름, 그래프 제목 지정하기
lineplot.set(
    ylim = (0,35000), 
    xlabel = '출발까지 남은일수 (days_left)',
    ylabel = '티켓 가격 (price)',
    title = '출발까지 남은일수에 따른 평균 티켓가격의 변화'
)
# x축 눈금 설정하기
lineplot.set_xticks(np.arange(0,50,5))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1570&quot; data-origin-height=&quot;833&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/m3VNP/btsH9pjTKA1/i0umm79SqjRV3WIimBA6g1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/m3VNP/btsH9pjTKA1/i0umm79SqjRV3WIimBA6g1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/m3VNP/btsH9pjTKA1/i0umm79SqjRV3WIimBA6g1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fm3VNP%2FbtsH9pjTKA1%2Fi0umm79SqjRV3WIimBA6g1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1570&quot; height=&quot;833&quot; data-origin-width=&quot;1570&quot; data-origin-height=&quot;833&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>plt</category>
      <category>plt.plot</category>
      <category>seaborn</category>
      <category>SNS</category>
      <category>sns.lineplot</category>
      <category>데이터프레임 시각화</category>
      <category>선그래프</category>
      <category>시각화</category>
      <category>파이썬 시각화</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/146</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlibseaborn-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%9C%BC%EB%A1%9C-%EC%84%A0%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%AC%EA%B8%B0-pltplot-snslineplot#entry146comment</comments>
      <pubDate>Tue, 25 Jun 2024 02:07:55 +0900</pubDate>
    </item>
    <item>
      <title>[matplotlib] plt.pyplot 한글 깨짐 한글폰트 표시하기</title>
      <link>https://sy-log.tistory.com/entry/matplotlib-pltpyplot-%ED%95%9C%EA%B8%80-%EA%B9%A8%EC%A7%90-%ED%95%9C%EA%B8%80%ED%8F%B0%ED%8A%B8-%ED%91%9C%EC%8B%9C%ED%95%98%EA%B8%B0</link>
      <description>&lt;h3 style=&quot;text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;matplotlib (plt) 그래프에서 한글 깨질 때 대처방법&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅&amp;nbsp; &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.rcParams[]&lt;/span&gt; 으로 전역 폰트 설정하기&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;rcParams로 전역 폰트을 한번만 설정해주면, 그래프를 작성할 때마다 설정해줄 필요가 없습니다.&lt;/b&gt;&lt;b&gt;rcParams는 차트의 다양한 꾸밈요소들을 모아놓은 딕셔너리라고 보면 되는데요, 글꼴뿐만 아니라 선이나 바탕색도 지정 가능해요.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;※ Document 참조 (&lt;a style=&quot;color: #000000;&quot; href=&quot;https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.rcParams&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.rcParams&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;아래와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plt.rcParams['font.family']&lt;/span&gt; 를 불러서 value값을 바꿔주면&lt;/b&gt;&lt;b&gt;해당 주피터노트북 파일 내에서 한글폰트 지정은 완료되므로, &lt;/b&gt;&lt;b&gt;다른 그래프를 그릴때 다시 지정해줄 필요가 없습니다.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;아래 예시와 같이 윈도우에서 맑은고딕, 나눔바른고딕 등으로 지정할 수 있으며, &lt;/b&gt;&lt;b&gt;맥에선 애플고딕으로 지정해주면 된다고 합니다.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre id=&quot;code_1719040557290&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 한글폰트 설정 (전역)
plt.rcParams['font.family'] = &quot;Malgun Gothic&quot;      # 윈도우, 맑은고딕
plt.rcParams['font.family'] = &quot;NanumBarunGothic&quot;   # 윈도우, 나눔바른고딕
plt.rcParams['font.family'] = &quot;NanumSquare&quot;        # 윈도우, 나눔스퀘어

plt.rcParams['font.family'] = &quot;AppleGothic&quot;        # 맥, 애플고딕

# 마이너트폰트 깨짐 방지
plt.rcParams['axes.unicode_minus'] = False&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1279&quot; data-origin-height=&quot;1129&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/t4Gk8/btsH89mE7nO/1NGN9PjzRvKZszD1YXLiq1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/t4Gk8/btsH89mE7nO/1NGN9PjzRvKZszD1YXLiq1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/t4Gk8/btsH89mE7nO/1NGN9PjzRvKZszD1YXLiq1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Ft4Gk8%2FbtsH89mE7nO%2F1NGN9PjzRvKZszD1YXLiq1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1279&quot; height=&quot;1129&quot; data-origin-width=&quot;1279&quot; data-origin-height=&quot;1129&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>matplotlib</category>
      <category>plt</category>
      <category>plt 한글글꼴</category>
      <category>plt 한글깨짐</category>
      <category>plt 한글폰트</category>
      <category>plt 한글표시</category>
      <category>pyplot</category>
      <category>Python</category>
      <category>rcparams</category>
      <category>파이썬</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/145</guid>
      <comments>https://sy-log.tistory.com/entry/matplotlib-pltpyplot-%ED%95%9C%EA%B8%80-%EA%B9%A8%EC%A7%90-%ED%95%9C%EA%B8%80%ED%8F%B0%ED%8A%B8-%ED%91%9C%EC%8B%9C%ED%95%98%EA%B8%B0#entry145comment</comments>
      <pubDate>Sat, 22 Jun 2024 16:34:30 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 그룹별 상관계수 살펴보기 :: corr (correlation)</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B7%B8%EB%A3%B9%EB%B3%84-%EC%83%81%EA%B4%80%EA%B3%84%EC%88%98-%EC%82%B4%ED%8E%B4%EB%B3%B4%EA%B8%B0-corr-correlation</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 수치형 데이터간 상관계수&amp;nbsp; ::&amp;nbsp; corr()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; letter-spacing: 0px; color: #000000;&quot;&gt;예시&amp;nbsp;데이터셋은&amp;nbsp;Kaggle에서&amp;nbsp;가져온&amp;nbsp;Flight&amp;nbsp;Price&amp;nbsp;Prediction&amp;nbsp;비행편&amp;nbsp;데이터셋입니다.&amp;nbsp; &lt;br /&gt;(캐글&amp;nbsp;데이터&amp;nbsp;다운로드:&amp;nbsp;&lt;a style=&quot;color: #000000;&quot; href=&quot;https://www.kaggle.com/datasets/shubhambathwal/flight-price-prediction)&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://www.kaggle.com/datasets/shubhambathwal/flight-price-prediction)&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;데이터프레임에 포함된 &lt;b&gt;수치형 데이터간의 상관관계&lt;/b&gt;는 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;corr&lt;/span&gt; 메소드로 간단하게 살펴볼 수 있습니다.&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;수치형만 적용 가능하므로 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;numeric_only = True&lt;/span&gt; 파라미터를 넣어줘야 합니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718887471655&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 변수들간 상관계수 살펴보기
df.corr(numeric_only=True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1448&quot; data-origin-height=&quot;341&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bVXA0r/btsH7hSckef/x0ieZcVJs7bS1PLs4yEob0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bVXA0r/btsH7hSckef/x0ieZcVJs7bS1PLs4yEob0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bVXA0r/btsH7hSckef/x0ieZcVJs7bS1PLs4yEob0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbVXA0r%2FbtsH7hSckef%2Fx0ieZcVJs7bS1PLs4yEob0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1448&quot; height=&quot;341&quot; data-origin-width=&quot;1448&quot; data-origin-height=&quot;341&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;이 데이터셋에 포함된 수치형 칼럼 3개 서로간의 상관계수들이 도출되었네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;duration(비행시간) - price(비행편 가격) 간 상관계수는 약 0.2로 약한 약의 상관관계를 보여주고 있습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;나머지 상관계수들은 0에 가까워서 거의 상관관계가 없다고 봐도 무방할 정도입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 데이터 그룹별로 상관계수 살펴보기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; letter-spacing: 0px; color: #000000;&quot;&gt;예시 데이터셋을 살펴보면, &lt;b&gt;범주형 데이터&lt;/b&gt; 칼럼이 대부분입니다.&lt;br /&gt;airline(비행사), source_city(출발도시), departure_time(출발시간), ..., class(좌석클래스) 까지 다양해요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1375&quot; data-origin-height=&quot;287&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bwPH8l/btsH52aTLkN/bjdCn1SW6TSugZGgbYIBqk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bwPH8l/btsH52aTLkN/bjdCn1SW6TSugZGgbYIBqk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bwPH8l/btsH52aTLkN/bjdCn1SW6TSugZGgbYIBqk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbwPH8l%2FbtsH52aTLkN%2FbjdCn1SW6TSugZGgbYIBqk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1375&quot; height=&quot;287&quot; data-origin-width=&quot;1375&quot; data-origin-height=&quot;287&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; letter-spacing: 0px; color: #000000;&quot;&gt;&lt;b&gt;범주형데이터의 고유값마다 그룹으로 묶어서&lt;/b&gt; 상관계수를 다시 뽑아보면 다르게 나올겁니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; letter-spacing: 0px; color: #000000;&quot;&gt;예를 들어서 class(좌석클래스) 마다 뽑아보면 어떨까요?&amp;nbsp;&lt;br /&gt;아래처럼, 비즈니스석과 이코노미석을 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;groupby()&lt;/span&gt;으로 나눠서 상관계수를 다시 보았습니다.&lt;br /&gt;&lt;b&gt;이코노미석의 경우, days_left(남은일수) - price(가격) 간 상관계수가 약 -0.56로 음의 상관관계가 꽤나 있습니다.&lt;/b&gt;&lt;br /&gt;비행까지 남은 일수가 적을수록 즉, 출발일자가 가까울수록 티켓가격은 비싸지는 거네요. 비즈니스석은 그렇지도 않지만요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718888029292&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 좌석클래스 그룹별로 상관계수 확인
df.groupby('class').corr(numeric_only=True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1481&quot; data-origin-height=&quot;526&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/zDarL/btsH5222QhF/5WbjhkgcsFSJquqlvHiY5K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/zDarL/btsH5222QhF/5WbjhkgcsFSJquqlvHiY5K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/zDarL/btsH5222QhF/5WbjhkgcsFSJquqlvHiY5K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FzDarL%2FbtsH5222QhF%2F5WbjhkgcsFSJquqlvHiY5K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1481&quot; height=&quot;526&quot; data-origin-width=&quot;1481&quot; data-origin-height=&quot;526&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;하나 더 테스트 해보겠습니다. &lt;b&gt;출발시간별&lt;/b&gt;로도 가격과의 상관관계가 달라질지 궁금하네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;groupby()&lt;/span&gt; 를 'departure_time' 칼럼을 기준으로 해서 뽑아보니 아래처럼 나옵니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;전체적으로 비행시간과 티켓가격이 양의 상관관계, 나머지는 약한 음의 상관관계를 보여주는데요,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;출발시간이 심야(Late_Night)인 경우, 특히 비행시간과 티켓가격 간 corr=0.50으로 양의 상관관계가 비교적 강합니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1194&quot; data-origin-height=&quot;962&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/EfD1o/btsH60pE4Dn/kuFcD8XTDXhEaJQIHACu00/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/EfD1o/btsH60pE4Dn/kuFcD8XTDXhEaJQIHACu00/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/EfD1o/btsH60pE4Dn/kuFcD8XTDXhEaJQIHACu00/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FEfD1o%2FbtsH60pE4Dn%2FkuFcD8XTDXhEaJQIHACu00%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1194&quot; height=&quot;962&quot; data-origin-width=&quot;1194&quot; data-origin-height=&quot;962&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>corr</category>
      <category>correlation</category>
      <category>pandas</category>
      <category>Python</category>
      <category>그룹별 상관계수</category>
      <category>데이터프레임 상관관계</category>
      <category>상관계수</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/144</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B7%B8%EB%A3%B9%EB%B3%84-%EC%83%81%EA%B4%80%EA%B3%84%EC%88%98-%EC%82%B4%ED%8E%B4%EB%B3%B4%EA%B8%B0-corr-correlation#entry144comment</comments>
      <pubDate>Thu, 20 Jun 2024 22:07:15 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 합치기 조인 병합 :: pd.merge (join)</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%ED%95%A9%EC%B9%98%EA%B8%B0-%EC%A1%B0%EC%9D%B8-%EB%B3%91%ED%95%A9-pdmerge-join</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 데이터프레임 생성&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터프레임 2개를 먼저 만들어 볼게요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718865723679&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 병합할 데이터프레임 2개 생성
df_customer = pd.DataFrame({
    'customer_id' : [1, 2, 3, 4, 5],
    'name' : ['Kim', 'Lee', 'Park', 'Choi', 'Yoon'],
    'grade' : ['Silver', 'Gold', 'Gold', 'Silver', 'Platinum']
})
df_orders = pd.DataFrame({
    'customer_id' : [1, 2, 2, 2, 3, 3, 5, 5, 5, 10],
    'item_order' : ['pumpkin', 'potato', 'garlic', 'carrot', 'cabbage', 'pumpkin', 'potato', 'corn', 'pepper', 'onion'],
    'quantity' : [2, 5, 10, 4, 2, 1, 4, 3, 6, 8]
})&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1342&quot; data-origin-height=&quot;1162&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Wf3HD/btsH5JhQ3w9/QviKpboAmZJc5tFKL3fCI1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Wf3HD/btsH5JhQ3w9/QviKpboAmZJc5tFKL3fCI1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Wf3HD/btsH5JhQ3w9/QviKpboAmZJc5tFKL3fCI1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FWf3HD%2FbtsH5JhQ3w9%2FQviKpboAmZJc5tFKL3fCI1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1342&quot; height=&quot;1162&quot; data-origin-width=&quot;1342&quot; data-origin-height=&quot;1162&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 교집합으로 합치기 (Inner Join)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;merge&lt;/span&gt; 메소드는 &lt;b&gt;SQL JOIN&lt;/b&gt; 에서 문법을 가져온 메소드라는 게 눈에 보이죠. 아래와 같이 요소들을 지정해줘야 합니다.&lt;br /&gt;pd.merge(&lt;span style=&quot;background-color: #dddddd;&quot;&gt;왼쪽에 위치할 df&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;오른쪽에 위치할 df&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;&lt;b&gt;on&lt;/b&gt; = '조인 기준이 되는 칼럼명'&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;&lt;b&gt;how&lt;/b&gt; = '조인 방식'&lt;/span&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;merge 메소드의 디폴트값이 how = 'inner' 이기 때문에, Inner Join을 하고 싶다면 아무것도 지정하지 않아도 됩니다.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;Inner&amp;nbsp;Join&amp;nbsp;=&amp;nbsp;교집합&amp;nbsp;방식&amp;nbsp;=&amp;nbsp;한쪽에&amp;nbsp;없는&amp;nbsp;칼럼이면&amp;nbsp;제외하고&amp;nbsp;공통으로&amp;nbsp;존재하는&amp;nbsp;칼럼만&amp;nbsp;남기는&amp;nbsp;방식&lt;/b&gt;입니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;따라서 아래처럼 df_customer에만 있는 4번 고객, df_orders에만 있는 10번 고객의 구매아이템은 &lt;b&gt;제외&lt;/b&gt;된 모습입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718867348507&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# Inner Join 방식으로 병합하기
pd.merge(df_customer, df_orders, on = 'customer_id')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1495&quot; data-origin-height=&quot;660&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/qiKTu/btsH6SLJVdS/PiWz4q1iLiW8ehW4NDsTg1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/qiKTu/btsH6SLJVdS/PiWz4q1iLiW8ehW4NDsTg1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/qiKTu/btsH6SLJVdS/PiWz4q1iLiW8ehW4NDsTg1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FqiKTu%2FbtsH6SLJVdS%2FPiWz4q1iLiW8ehW4NDsTg1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1495&quot; height=&quot;660&quot; data-origin-width=&quot;1495&quot; data-origin-height=&quot;660&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 합집합으로 합치기 (Outer Join)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;Outer Join = 합집합 방식 = 한쪽에 없는 칼럼이어도 전부 포함해서 합치는 방식&lt;/b&gt;입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;따라서 아래처럼 df_customer에만 있는 4번 고객, df_orders에만 있는 10번 고객의 구매아이템도 &lt;b&gt;전부 포함&lt;/b&gt;되었습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이에 따라 없던 셀도 생기면서 &lt;b&gt;NaN&lt;/b&gt;값이 되었습니다. 결측치 처리된거죠.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1690&quot; data-origin-height=&quot;700&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dwLDpf/btsH6Ch63Zr/hjNjHnxKKFoRhao4Kt5Wk1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dwLDpf/btsH6Ch63Zr/hjNjHnxKKFoRhao4Kt5Wk1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dwLDpf/btsH6Ch63Zr/hjNjHnxKKFoRhao4Kt5Wk1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdwLDpf%2FbtsH6Ch63Zr%2FhjNjHnxKKFoRhao4Kt5Wk1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1690&quot; height=&quot;700&quot; data-origin-width=&quot;1690&quot; data-origin-height=&quot;700&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 왼쪽 or 오른쪽 데이터프레임 기준으로 합치기 (Left Join, Right Join)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;Left Join&lt;/b&gt; : &lt;b&gt;왼쪽 데이터프레임에 있는 건 전부&lt;/b&gt; 가져옵니다. 왼쪽에 없는데 &lt;b&gt;오른쪽에만 존재하는 데이터는 제외&lt;/b&gt;합니다.&lt;br /&gt;아래 예시를 보시면, df_cutomer에만 있는 4번 고객이 포함되어 있죠.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;Right Join&lt;/b&gt; : 위와 반대입니다. &lt;b&gt;오른쪽 데이터프레임에 있는 건 전부&lt;/b&gt; 가져오고, &lt;b&gt;왼쪽에만 존재하는 건 제외&lt;/b&gt;합니다.&lt;br /&gt;마찬가지로 df_orders에만 존재하는 10번 고객의 구매아이템이 포함되어 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718868124722&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# Left Join 방식으로 병합하기
pd.merge(df_customer, df_orders, on = 'customer_id', how = 'left')

# Right Join 방식으로 병합하기
pd.merge(df_customer, df_orders, on = 'customer_id', how = 'right')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1565&quot; data-origin-height=&quot;622&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cgtECO/btsH6YEYjsV/1D6cwobJGqJllz31V1ike1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cgtECO/btsH6YEYjsV/1D6cwobJGqJllz31V1ike1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cgtECO/btsH6YEYjsV/1D6cwobJGqJllz31V1ike1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcgtECO%2FbtsH6YEYjsV%2F1D6cwobJGqJllz31V1ike1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1565&quot; height=&quot;622&quot; data-origin-width=&quot;1565&quot; data-origin-height=&quot;622&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;*️⃣&amp;nbsp; 인덱스를 기준으로 합치고 싶을 때&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래처럼, 두 데이터프레임의 &lt;b&gt;인덱스를 기준으로 조인&lt;/b&gt;을 시킬 수도 있습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;이 경우 이미 인덱스를 기준으로 한다는 파라미터가 들어가므로, 파라미터 on 은 필요 없습니다.&lt;br /&gt;파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;how&lt;/span&gt;를 추가해서 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;outer, left, right&lt;/span&gt; 등 조인 방식을 바꿀 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718868716849&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 두 인덱스를 기준으로 지정 &amp;rarr; Inner Join과 동일
pd.merge(df_customer, df_orders, left_index = True, right_index = True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1225&quot; data-origin-height=&quot;599&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bZ5Vrw/btsH50qfRrY/vZPcZqb1KYvPPMBKv1kajk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bZ5Vrw/btsH50qfRrY/vZPcZqb1KYvPPMBKv1kajk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bZ5Vrw/btsH50qfRrY/vZPcZqb1KYvPPMBKv1kajk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbZ5Vrw%2FbtsH50qfRrY%2FvZPcZqb1KYvPPMBKv1kajk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1225&quot; height=&quot;599&quot; data-origin-width=&quot;1225&quot; data-origin-height=&quot;599&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>dataframe join</category>
      <category>pandas</category>
      <category>pd.merge</category>
      <category>Python</category>
      <category>데이터프레임 병합</category>
      <category>데이터프레임 조인</category>
      <category>데이터프레임 합치기</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/143</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%ED%95%A9%EC%B9%98%EA%B8%B0-%EC%A1%B0%EC%9D%B8-%EB%B3%91%ED%95%A9-pdmerge-join#entry143comment</comments>
      <pubDate>Thu, 20 Jun 2024 16:37:15 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 합치기 병합하기 :: pd.concat</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%ED%95%A9%EC%B9%98%EA%B8%B0-%EB%B3%91%ED%95%A9%ED%95%98%EA%B8%B0-pdconcat</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 데이터프레임 생성&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시가 될 데이터프레임 2개를 먼저 만들어 볼게요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718855945394&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 병합할 데이터프레임 2개 생성
df_1 = pd.DataFrame({
    'product' : ['onion', 'carrot', 'cabbage', 'pumpkin', 'potato'],
    'amount' : [100, 50, 70, 30, 80] 
})
df_2 = pd.DataFrame({
    'product' : ['pumpkin', 'potato', 'garlic', 'corn', 'pepper'],
    'amount' : [20, 60, 90, 80, 50]
}, index = [3,4,5,6,7])&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1264&quot; data-origin-height=&quot;882&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bpetDh/btsH62mZizd/17NEyr6xKmmTnSVkzt09jK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bpetDh/btsH62mZizd/17NEyr6xKmmTnSVkzt09jK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bpetDh/btsH62mZizd/17NEyr6xKmmTnSVkzt09jK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbpetDh%2FbtsH62mZizd%2F17NEyr6xKmmTnSVkzt09jK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1264&quot; height=&quot;882&quot; data-origin-width=&quot;1264&quot; data-origin-height=&quot;882&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 칼럼 이름이 &lt;span style=&quot;color: #000000; background-color: #dddddd;&quot;&gt;동일&lt;/span&gt;한 데이터프레임끼리 합치는 경우&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-1.&amp;nbsp; 행 레벨로 합치기 (기본값, axis=0)&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;두 데이터프레임을 &lt;b&gt;행 레벨로 = 위아래&lt;/b&gt;로 붙이고 싶은 경우 파라미터를 지정하지 않아도 됩니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;axis=0 &lt;/span&gt;이 디폴트값이거든요.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 이렇게 병합하면 인덱스도 원래것 그대로 붙습니다. &lt;b&gt;인덱스 초기화&lt;/b&gt;가 필요하다면&lt;span style=&quot;background-color: #dddddd;&quot;&gt; ignore_index = True&lt;/span&gt; 를 추가해주세요.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;혹시 몇천 몇만행짜리 데이터프레임을 합쳐야 하는데, 인덱스가 중복되는지 확인하고 싶은 경우라면&lt;br /&gt;파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;verify_integrity = True&lt;/span&gt; 를 추가하세요. 중복된다면 에러가 뜨도록 해주는 파라미터입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718862788108&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 기존 인덱스들을 유지하면서 병합 (디폴트)
pd.concat([df_1, df_2])

# 병합하면서 인덱스 초기화
pd.concat([df_1, df_2], ignore_index = True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1149&quot; data-origin-height=&quot;573&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b53u3u/btsH6h5KKmp/MGwoX3EsY0wzS8dPJV3fqK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b53u3u/btsH6h5KKmp/MGwoX3EsY0wzS8dPJV3fqK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b53u3u/btsH6h5KKmp/MGwoX3EsY0wzS8dPJV3fqK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb53u3u%2FbtsH6h5KKmp%2FMGwoX3EsY0wzS8dPJV3fqK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1149&quot; height=&quot;573&quot; data-origin-width=&quot;1149&quot; data-origin-height=&quot;573&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-2.&amp;nbsp; 칼럼(열) 레벨로 합치기 (axis=1)&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;두 데이터프레임을 &lt;b&gt;열 레벨로 = 옆으로&lt;/b&gt; 붙이고 싶다면&lt;span style=&quot;background-color: #dddddd;&quot;&gt; axis=1&lt;/span&gt; 로 지정해줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래처럼 인덱스 기준으로 병합되기 때문에, 원래 데이터프레임에 없던 셀들은 &lt;b&gt;NaN&lt;/b&gt;으로 채워집니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718862866765&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 칼럼 레벨로 병합 (옆으로 붙임)
pd.concat([df_1, df_2], axis=1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1405&quot; data-origin-height=&quot;579&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/u6SmK/btsH6SSs1as/ubdgpPx3LyNYXlOJZ9BW7k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/u6SmK/btsH6SSs1as/ubdgpPx3LyNYXlOJZ9BW7k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/u6SmK/btsH6SSs1as/ubdgpPx3LyNYXlOJZ9BW7k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fu6SmK%2FbtsH6SSs1as%2FubdgpPx3LyNYXlOJZ9BW7k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1405&quot; height=&quot;579&quot; data-origin-width=&quot;1405&quot; data-origin-height=&quot;579&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp;&lt;span style=&quot;color: #000000;&quot;&gt; 칼럼 이름이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;다른&lt;/span&gt;&amp;nbsp;데이터프레임끼리 합치는 경우&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;위에서 만들었던 df_2 에 새로운 칼럼을 붙였습니다. 이제 두 데이터프레임의 칼럼이 다른데요,&lt;br /&gt;이런 경우 파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;join&lt;/span&gt; 을 추가하여, &lt;b&gt;어떤 방식으로 병합할지&lt;/b&gt; 정해줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1069&quot; data-origin-height=&quot;320&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Xz0aF/btsH4VXBmRl/AIwvCiosnwJEambL12aaL1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Xz0aF/btsH4VXBmRl/AIwvCiosnwJEambL12aaL1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Xz0aF/btsH4VXBmRl/AIwvCiosnwJEambL12aaL1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FXz0aF%2FbtsH4VXBmRl%2FAIwvCiosnwJEambL12aaL1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1069&quot; height=&quot;320&quot; data-origin-width=&quot;1069&quot; data-origin-height=&quot;320&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-1.&amp;nbsp; 합집합으로 병합하기 (Outer Join)&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;합집합처럼, 한쪽에 없는 칼럼이어도 포함해서 병합하는 방식&lt;/b&gt;입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;join = 'outer'&lt;/span&gt; 로 지정해주면 됩니다.&lt;/span&gt; &lt;span style=&quot;color: #9d9d9d;&quot;&gt;(데이터베이스 Outer Join과 동일한 방식)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;아래처럼 df_2의 grade 칼럼까지 포함해서 합쳐집니다. df_1에서 grade는 없는 칼럼이었으니 NaN값으로 채워지구요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣-2.&amp;nbsp; 교집합으로 병합하기 (Inner Join)&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;마찬가지로 &lt;b&gt;교집합처럼, 한쪽에 없는 칼럼이면 제외하고 공통으로 존재하는 칼럼만 남기는 방식&lt;/b&gt;입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;파라미터&lt;span style=&quot;background-color: #dddddd;&quot;&gt; join = 'inner'&lt;/span&gt; 로 지정해주면 됩니다.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #9d9d9d;&quot;&gt;(데이터베이스 Inner Join과 동일한 방식)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718864031393&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 합집합 방식으로 병합하기 (Outer Join) : 한쪽에 없는 칼럼이어도 전부 포함
pd.concat([df_1, df_2], join = 'outer')

# 교집합 방식으로 병합하기 (Inner Join) : 한쪽에 없는 칼럼이면 제외, 공통 칼럼만 남김
pd.concat([df_1, df_2], join = 'inner')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1144&quot; data-origin-height=&quot;582&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/du8AwH/btsH6cX9XmD/3PaXaDMkBfAztgRi40RsyK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/du8AwH/btsH6cX9XmD/3PaXaDMkBfAztgRi40RsyK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/du8AwH/btsH6cX9XmD/3PaXaDMkBfAztgRi40RsyK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fdu8AwH%2FbtsH6cX9XmD%2F3PaXaDMkBfAztgRi40RsyK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1144&quot; height=&quot;582&quot; data-origin-width=&quot;1144&quot; data-origin-height=&quot;582&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>concat</category>
      <category>pandas</category>
      <category>pd.concat</category>
      <category>Python</category>
      <category>데이터프레임 병합</category>
      <category>데이터프레임 합치기</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/142</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%ED%95%A9%EC%B9%98%EA%B8%B0-%EB%B3%91%ED%95%A9%ED%95%98%EA%B8%B0-pdconcat#entry142comment</comments>
      <pubDate>Thu, 20 Jun 2024 15:36:01 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임에서 피벗테이블 만들기 :: pivot_table pivot table</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%97%90%EC%84%9C-%ED%94%BC%EB%B2%97%ED%85%8C%EC%9D%B4%EB%B8%94-%EB%A7%8C%EB%93%A4%EA%B8%B0-pivottable-pivot-table</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 데이터프레임 생성&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;먼저 테스트를 위한 데이터프레임을 생성하겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718721541534&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 테스트 데이터프레임 생성
df = pd.DataFrame({
    'container_id' : ['con_1', 'con_1', 'con_1', 'con_2', 'con_2', 'con_2', 'con_3', 'con_3', 'con_3'],
    'product' : ['monitor', 'pc', 'cable', 'monitor', 'pc', 'cable', 'monitor', 'pc', 'cable'],
    'made' : ['korea', 'korea', 'korea', 'korea', 'korea', 'korea', 'china', 'china', 'china'],
    'amount' : [30, 10, 20, 40, 10, 50, 60, 0, 30]
})&lt;/code&gt;&lt;/pre&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 피벗테이블 생성&amp;nbsp; ::&amp;nbsp; .pivot_table&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터프레임으로도 엑셀처럼 피벗테이블을 만들 수 있습니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;pivot_table&lt;/span&gt; 메소드를 활용하면 되는데요,&lt;br /&gt;각각 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;index&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;columns&lt;/span&gt;, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;values&lt;/span&gt; 가 될 칼럼 총 3개를 지정해주면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;values 값을 집계하는 방법은 아무것도 지정하지 않아도, 기본적으로 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;평균값(mean)&lt;/span&gt;으로 계산됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718721602867&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 피벗테이블 만들기 (디폴트 평균값)
df.pivot_table(
    index = 'made',
    columns = 'product',
    values = 'amount'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1744&quot; data-origin-height=&quot;556&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/beun5b/btsH38hoAsb/D8KFBjhgR0SMgmoWoJzktK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/beun5b/btsH38hoAsb/D8KFBjhgR0SMgmoWoJzktK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/beun5b/btsH38hoAsb/D8KFBjhgR0SMgmoWoJzktK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbeun5b%2FbtsH38hoAsb%2FD8KFBjhgR0SMgmoWoJzktK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1744&quot; height=&quot;556&quot; data-origin-width=&quot;1744&quot; data-origin-height=&quot;556&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;집계방식을 바꾸고 싶다면, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;aggfunc&lt;/span&gt; 파라미터를 추가해서 변경해주면 됩니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;'count', 'min', 'max', 'sum' 등을 지정할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718721976851&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 집계방식 합계로 바꾸기
df.pivot_table(
    index = 'made', columns = 'product', values = 'amount',
    aggfunc = 'sum'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1214&quot; data-origin-height=&quot;372&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/u53zi/btsH4LsbAlY/widK7Tpym2D0CBE14nPQak/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/u53zi/btsH4LsbAlY/widK7Tpym2D0CBE14nPQak/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/u53zi/btsH4LsbAlY/widK7Tpym2D0CBE14nPQak/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fu53zi%2FbtsH4LsbAlY%2FwidK7Tpym2D0CBE14nPQak%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1214&quot; height=&quot;372&quot; data-origin-width=&quot;1214&quot; data-origin-height=&quot;372&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 행열마다 총계 더하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;엑셀에서 피벗테이블을 만들면, 기본적으로 &lt;b&gt;행열마다 총계&lt;/b&gt;가 붙어나오죠. 데이터프레임도 가능합니다.&lt;br /&gt;파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;margins=True&lt;/span&gt; 를 추가하면 됩니다. 아래처럼 총계값들도 지정해둔 집계방식(합계, 평균 등)을 따라갑니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718722113653&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 행열마다 합계 더하기 (Subtotal)
df.pivot_table(
    index = 'made', columns = 'product', values = 'amount',
    aggfunc = 'sum',
    margins = True
)

# 행열마다 평균값 집계
df.pivot_table(
    index = 'made', columns = 'product', values = 'amount',
    aggfunc = 'mean',
    margins = True
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1195&quot; data-origin-height=&quot;880&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/rT6eG/btsH28CdeZY/gKKLbDK5obSmYHJwRD7uj1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/rT6eG/btsH28CdeZY/gKKLbDK5obSmYHJwRD7uj1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/rT6eG/btsH28CdeZY/gKKLbDK5obSmYHJwRD7uj1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FrT6eG%2FbtsH28CdeZY%2FgKKLbDK5obSmYHJwRD7uj1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1195&quot; height=&quot;880&quot; data-origin-width=&quot;1195&quot; data-origin-height=&quot;880&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 집계값 여러개 한번에 보기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;집계값을 여러개 보고 싶은 경우라면, 파라미터 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;aggfunc&lt;/span&gt;에 &lt;b&gt;리스트를 넣어주면&lt;/b&gt; 됩니다. 여기에 총계를 더할 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718722670792&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 여러개 집계해서 한번에 보기
df.pivot_table(
    index = 'made', columns = 'product', values = 'amount',
    aggfunc = ['count', 'sum', 'mean']
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1244&quot; data-origin-height=&quot;911&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bj5Nze/btsH3xPa8P4/N8oEgazlMGa92eBZ9EqbWK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bj5Nze/btsH3xPa8P4/N8oEgazlMGa92eBZ9EqbWK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bj5Nze/btsH3xPa8P4/N8oEgazlMGa92eBZ9EqbWK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbj5Nze%2FbtsH3xPa8P4%2FN8oEgazlMGa92eBZ9EqbWK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1244&quot; height=&quot;911&quot; data-origin-width=&quot;1244&quot; data-origin-height=&quot;911&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣&amp;nbsp; 인덱스 여러개 넣어서 피벗테이블 만들기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;인덱스를 여러개 넣고 싶은 경우도 마찬가지입니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;index&lt;/span&gt;에 &lt;b&gt;리스트를 넣으면&lt;/b&gt; 차례대로 멀티인덱싱이 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718722751235&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 인덱스 여러개
df.pivot_table(
    index = ['made', 'container_id'],
    columns = 'product',
    values = 'amount'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1338&quot; data-origin-height=&quot;440&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/WxNxE/btsH2Jv3Vun/pMImtH8xYVZAhbknNl2TO0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/WxNxE/btsH2Jv3Vun/pMImtH8xYVZAhbknNl2TO0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/WxNxE/btsH2Jv3Vun/pMImtH8xYVZAhbknNl2TO0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FWxNxE%2FbtsH2Jv3Vun%2FpMImtH8xYVZAhbknNl2TO0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1338&quot; height=&quot;440&quot; data-origin-width=&quot;1338&quot; data-origin-height=&quot;440&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>pandas</category>
      <category>pivot table</category>
      <category>pivot_table</category>
      <category>Python</category>
      <category>데이터프레임 피벗</category>
      <category>데이터프레임 피벗테이블</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/141</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84%EC%97%90%EC%84%9C-%ED%94%BC%EB%B2%97%ED%85%8C%EC%9D%B4%EB%B8%94-%EB%A7%8C%EB%93%A4%EA%B8%B0-pivottable-pivot-table#entry141comment</comments>
      <pubDate>Wed, 19 Jun 2024 00:13:19 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 그룹화 그룹핑 그룹집계하기 :: groupby, aggregate</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B7%B8%EB%A3%B9%ED%99%94-%EA%B7%B8%EB%A3%B9%ED%95%91-groupby</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 특정 칼럼을 기준으로 데이터프레임 그룹화하기&amp;nbsp; ::&amp;nbsp; groupby&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 비행편 데이터셋인데요, 첫번째 칼럼은 쓸모없으니 삭제하고&lt;br /&gt;&lt;b&gt;출발시간(departure_time) 칼럼을 기준으로 데이터를 그룹화&lt;/b&gt; 시켜보았습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 그룹핑시킨 결과를 출력해도 깔끔한 데이터셋이 나오는 건 아닙니다.&lt;br /&gt;이 결과 중에 &lt;b&gt;무엇을 출력할지 선택&lt;/b&gt;해줘야 하는데요, 하나씩 테스트 해보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718709524781&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 데이터셋 불러오기
df = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df = df.drop('Unnamed: 0', axis=1)

# departure_time(출발시간) 칼럼 기준으로 그룹핑
dt_group = df.groupby(by='departure_time')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1244&quot; data-origin-height=&quot;189&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/lcVpX/btsH4IoDPwh/i1w88q6Yb1u45uBEakdlQK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/lcVpX/btsH4IoDPwh/i1w88q6Yb1u45uBEakdlQK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/lcVpX/btsH4IoDPwh/i1w88q6Yb1u45uBEakdlQK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FlcVpX%2FbtsH4IoDPwh%2Fi1w88q6Yb1u45uBEakdlQK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1244&quot; height=&quot;189&quot; data-origin-width=&quot;1244&quot; data-origin-height=&quot;189&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 그룹 개수, 그룹별 데이터 개수&amp;nbsp; ::&amp;nbsp; .ngroups .size()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;pre id=&quot;code_1718709872090&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그룹 개수
dt_group.ngroups

# 그룹별 데이터 개수
dt_group.size()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1091&quot; data-origin-height=&quot;434&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/mPPU7/btsH2IKDyZH/RNqmrR4tNAhNOiHEwfTu31/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/mPPU7/btsH2IKDyZH/RNqmrR4tNAhNOiHEwfTu31/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/mPPU7/btsH2IKDyZH/RNqmrR4tNAhNOiHEwfTu31/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmPPU7%2FbtsH2IKDyZH%2FRNqmrR4tNAhNOiHEwfTu31%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1091&quot; height=&quot;434&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1091&quot; data-origin-height=&quot;434&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 그룹별 최솟값, 최댓값 출력하기&amp;nbsp; ::&amp;nbsp; .min() .max()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;min, max&lt;/span&gt;를 사용하여 그룹별 데이터의 최솟값과 최댓값을 출력할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다만 아래처럼 문자열도 알파벳 기준으로 최솟값과 최댓값을 출력해주는 모습인데요, &lt;b&gt;문자열을 제외하고 수치데이터만 보려면&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;numeric_only=True&lt;/span&gt; 파라미터를 추가하면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718710113409&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그룹별 최솟값 확인
dt_group.min()

# 그룹별 최댓값 확인 &amp;rarr; 수치형데이터 칼럼만 
dt_group.max(numeric_only=True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1268&quot; data-origin-height=&quot;941&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/VRsEk/btsH3AykizW/4XL4V7jlkgU6m6andXFI30/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/VRsEk/btsH3AykizW/4XL4V7jlkgU6m6andXFI30/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/VRsEk/btsH3AykizW/4XL4V7jlkgU6m6andXFI30/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVRsEk%2FbtsH3AykizW%2F4XL4V7jlkgU6m6andXFI30%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1268&quot; height=&quot;941&quot; data-origin-width=&quot;1268&quot; data-origin-height=&quot;941&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 그룹별 평균값, 중간값 출력하기&amp;nbsp; ::&amp;nbsp; .mean() .median()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;mean, median&lt;/span&gt;은 위의 min, max와 다르게, 문자열이 포함되어 있으니 연산할 수 없다는 에러가 나옵니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;따라서 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;numeric_only=True&lt;/span&gt; 파라미터를 필수로 넣어줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이렇게 출력한 결과에서 &lt;b&gt;특정 칼럼만 추출&lt;/b&gt;해보고 싶다면, 데이터프레임 칼럼 뽑듯이 대괄호 2개 안에 칼럼명을 넣으면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718710473316&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 그룹별 평균값 확인
dt_group.mean(numeric_only=True)

# 그룹별 평균값 확인 &amp;rarr; 필요한 칼럼만 추출
dt_group.mean(numeric_only=True)[['price']]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1229&quot; data-origin-height=&quot;942&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cA93rM/btsH4fUKmAK/aKk9JSPyZjcep9kD3zm601/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cA93rM/btsH4fUKmAK/aKk9JSPyZjcep9kD3zm601/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cA93rM/btsH4fUKmAK/aKk9JSPyZjcep9kD3zm601/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcA93rM%2FbtsH4fUKmAK%2FaKk9JSPyZjcep9kD3zm601%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1229&quot; height=&quot;942&quot; data-origin-width=&quot;1229&quot; data-origin-height=&quot;942&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣&amp;nbsp; 칼럼 여러개로 그룹화하기 - 멀티인덱싱 (multi-indexing)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼 여러개를 기준으로 그룹화 시키고 싶다면, groupby를 쓸 때 아래처럼 리스트로 칼럼을 넣어주면 됩니다.&lt;br /&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.groupby(by=['칼럼명1', '칼럼명2'])&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;평균값을 출력해보면, 그룹화 기준이 된 원데이터의 칼럼 2개가 &lt;b&gt;인덱스 2개&lt;/b&gt;로 들어가 있습니다. &lt;b&gt;(멀티인덱싱)&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718711044511&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 칼럼 여러개로 그룹핑하기 &amp;rarr; 멀티인덱싱
airline_dt_group = df.groupby(by=['airline', 'departure_time'])

# 멀티 그룹별 평균값 확인
airline_dt_group.mean(numeric_only=True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1105&quot; data-origin-height=&quot;847&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cUA62T/btsH38uQ7VJ/MTi5W1fZr9pLGU25RpqwSk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cUA62T/btsH38uQ7VJ/MTi5W1fZr9pLGU25RpqwSk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cUA62T/btsH38uQ7VJ/MTi5W1fZr9pLGU25RpqwSk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcUA62T%2FbtsH38uQ7VJ%2FMTi5W1fZr9pLGU25RpqwSk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1105&quot; height=&quot;847&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1105&quot; data-origin-height=&quot;847&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;인덱스가 2개 이상이면 출력한 결과도 많아집니다. 이중에서 &lt;b&gt;원하는 인덱스만 선택&lt;/b&gt;해서 보고싶다면&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;일반적인 데이터프레임에서 행 뽑듯이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;loc&lt;/span&gt;메소드를 써주면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;만약 &lt;b&gt;멀티인덱스로 행을 선택&lt;/b&gt;하고 싶다면, 아래처럼 &lt;b&gt;튜플형식&lt;/b&gt;으로 넣어줘야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718711057703&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 원하는 인덱스(행)만 출력하기 (1) - 1번째 인덱스 선택
airline_dt_group.mean(numeric_only=True).loc[['Air_India']]

# 원하는 인덱스(행)만 출력하기 (2) - 튜플형식으로 1,2번째 인덱스 함께 선택
airline_dt_group.mean(numeric_only=True).loc[[('Air_India', 'Morning')]]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1230&quot; data-origin-height=&quot;725&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bxDoFJ/btsH2CRb8zC/QPyGIV4Sz4IXX8ebkuA87K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bxDoFJ/btsH2CRb8zC/QPyGIV4Sz4IXX8ebkuA87K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bxDoFJ/btsH2CRb8zC/QPyGIV4Sz4IXX8ebkuA87K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbxDoFJ%2FbtsH2CRb8zC%2FQPyGIV4Sz4IXX8ebkuA87K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1230&quot; height=&quot;725&quot; data-origin-width=&quot;1230&quot; data-origin-height=&quot;725&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;5️⃣&amp;nbsp; 그룹화 결과를 여러가지 집계값으로 한번에 보기&amp;nbsp; ::&amp;nbsp; aggregate&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;최솟값, 최댓값, 평균값.. 하나씩 뽑기보다, 보고서 작성 등을 위해 &lt;b&gt;한번에 볼 수 있도록&lt;/b&gt; &lt;b&gt;집계&lt;/b&gt;해야 할때,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;aggregate&lt;/span&gt; 메소드를 유용하게 활용할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;위에서 멀티인덱싱 해놓았던 결과를 가지고 aggregate 테스트를 해보려고 하는데요, 살짝 귀찮은 과정이 필요합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; aggregate는 &lt;b&gt;numeric_only 파라미터가 없기 때문에&lt;/b&gt; 그냥 쓰면 에러가 날 수 있습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래와 같이 그룹화한 다음 &lt;b&gt;수치형 칼럼만 뽑아놓고, 그 결과에서 aggregate를 써줘야 합니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718713899083&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 칼럼 여러개로 그룹핑 &amp;rarr; 수치형데이터 칼럼만 추출해놓기
airline_dt_group = df.groupby(by=['airline', 'departure_time'])[['duration', 'price']]

# 최솟값, 최댓값, 평균값 한번에 집계하기
airline_dt_group.aggregate(['min', 'max', 'mean'])&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1044&quot; data-origin-height=&quot;919&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c7LMvq/btsH3pcA0Mw/rdd5iOgaDlMmNG7kAOAMF0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c7LMvq/btsH3pcA0Mw/rdd5iOgaDlMmNG7kAOAMF0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c7LMvq/btsH3pcA0Mw/rdd5iOgaDlMmNG7kAOAMF0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc7LMvq%2FbtsH3pcA0Mw%2Frdd5iOgaDlMmNG7kAOAMF0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1044&quot; height=&quot;919&quot; data-origin-width=&quot;1044&quot; data-origin-height=&quot;919&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;</description>
      <category>직접 해보기/Python</category>
      <category>groupby</category>
      <category>pandas</category>
      <category>Python</category>
      <category>데이터프레임 그룹핑</category>
      <category>데이터프레임 그룹화</category>
      <category>멀티인덱싱</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/140</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B7%B8%EB%A3%B9%ED%99%94-%EA%B7%B8%EB%A3%B9%ED%95%91-groupby#entry140comment</comments>
      <pubDate>Tue, 18 Jun 2024 20:46:54 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 정렬하기 :: sort_values, sort values</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%A0%95%EB%A0%AC%ED%95%98%EA%B8%B0-sortvalues-sort-values</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 데이터프레임 생성&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;먼저 테스트를 위한 데이터프레임을 생성하겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718690687989&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 테스트용 데이터프레임 생성
df = pd.DataFrame({
    'col1': ['A', 'A', 'B', np.nan, 'D', 'C', 'D', 'C'],
    'col2': [3, 1, 9, 8, 7, 4, 5, 6],
    'col3': [0, 1, 8, 4, 2, 3, 7, 9],
    'col4': ['a', 'B', 'c', 'D', 'e', 'F', 'g', 'H']
})&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1264&quot; data-origin-height=&quot;411&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/n5Fvy/btsH3net5kq/F8kpl2qdELJmiqb7kkKYr1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/n5Fvy/btsH3net5kq/F8kpl2qdELJmiqb7kkKYr1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/n5Fvy/btsH3net5kq/F8kpl2qdELJmiqb7kkKYr1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fn5Fvy%2FbtsH3net5kq%2FF8kpl2qdELJmiqb7kkKYr1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1264&quot; height=&quot;411&quot; data-origin-width=&quot;1264&quot; data-origin-height=&quot;411&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 칼럼 기준으로 정렬하기 (오름차순, 내림차순)&amp;nbsp; ::&amp;nbsp; sort_values&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터프레임의 특정칼럼 기준으로 정렬하고 싶다면 sort_values 를 사용하면 됩니다.&lt;br /&gt;ascending 파라미터를 이용해서 오름차순 or 내림차순으로 정렬시킬 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718691053948&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# col2 칼럼 기준 오름차순으로 정렬하기
df = df.sort_values(by='col2', ascending=True)

# col2 칼럼 기준 내림차순으로 정렬하기
df = df.sort_values(by='col2', ascending=False)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1267&quot; data-origin-height=&quot;1084&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/2Sl2Z/btsH2Vo0f6l/L5pKVs6t6k7fpnU5CBkVN0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/2Sl2Z/btsH2Vo0f6l/L5pKVs6t6k7fpnU5CBkVN0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/2Sl2Z/btsH2Vo0f6l/L5pKVs6t6k7fpnU5CBkVN0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F2Sl2Z%2FbtsH2Vo0f6l%2FL5pKVs6t6k7fpnU5CBkVN0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1267&quot; height=&quot;1084&quot; data-origin-width=&quot;1267&quot; data-origin-height=&quot;1084&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;참고로 문자열 기준으로 오름차순 정렬을 한다면, 아래처럼 대문자가 먼저 취급됩니다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1242&quot; data-origin-height=&quot;529&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bVu7od/btsH2lhvcBc/FLFRhfTbJsGQ92EoDetvd0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bVu7od/btsH2lhvcBc/FLFRhfTbJsGQ92EoDetvd0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bVu7od/btsH2lhvcBc/FLFRhfTbJsGQ92EoDetvd0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbVu7od%2FbtsH2lhvcBc%2FFLFRhfTbJsGQ92EoDetvd0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1242&quot; height=&quot;529&quot; data-origin-width=&quot;1242&quot; data-origin-height=&quot;529&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 정렬할 때 빈데이터 위치 지정하기 &lt;/b&gt;(NaN, NA, None 등)&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;col1 처럼 데이터에 NaN값이 끼어있다면 어떻게 정렬될까요? 오름차순이던 내림차순이던 무조건 맨 마지막으로 갑니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;만약 NaN값의 위치를 정해주고 싶다면 na_position 파라미터를 지정해주면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718691804187&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# col1 칼럼 기준 오름차순으로 정렬하기 (빈 데이터를 맨 처음으로)
df = df.sort_values(by='col1', ascending=True, na_position='first')

# 다시 마지막으로 지정하고 싶다면 na_position='last'&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1171&quot; data-origin-height=&quot;1001&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cz8S8X/btsH4ayOVqZ/cQZB1Dsj5LBuypHVGfpRk0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cz8S8X/btsH4ayOVqZ/cQZB1Dsj5LBuypHVGfpRk0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cz8S8X/btsH4ayOVqZ/cQZB1Dsj5LBuypHVGfpRk0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcz8S8X%2FbtsH4ayOVqZ%2FcQZB1Dsj5LBuypHVGfpRk0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1171&quot; height=&quot;1001&quot; data-origin-width=&quot;1171&quot; data-origin-height=&quot;1001&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 칼럼 2개 이상을 기준으로 정렬하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼 여러개를 기준으로 정렬하는 것도 가능합니다. 아래와 같이 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;by&lt;/span&gt; 에 리스트 형태로 칼럼명을 넣어주면 됩니다.&lt;br /&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;by = ['칼럼명1', '칼럼명2', ..]&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;리스트에 먼저 들어간 칼럼 기준으로 정렬됩니다. &lt;br /&gt;다시 말해 '칼럼명1'에 대해 먼저 정렬하고, 그 상태에서 '칼럼명2'에 대해 다시 정렬하고.. 이런식이죠.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1160&quot; data-origin-height=&quot;546&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/kLZKu/btsH355whse/CkzOZ952vK9vEYDfYb1oaK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/kLZKu/btsH355whse/CkzOZ952vK9vEYDfYb1oaK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/kLZKu/btsH355whse/CkzOZ952vK9vEYDfYb1oaK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FkLZKu%2FbtsH355whse%2FCkzOZ952vK9vEYDfYb1oaK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1160&quot; height=&quot;546&quot; data-origin-width=&quot;1160&quot; data-origin-height=&quot;546&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>pandas</category>
      <category>Python</category>
      <category>sort values</category>
      <category>sort_values</category>
      <category>내림차순 정렬</category>
      <category>데이터프레임 정렬</category>
      <category>오름차순 정렬</category>
      <category>칼럼정렬</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/139</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%A0%95%EB%A0%AC%ED%95%98%EA%B8%B0-sortvalues-sort-values#entry139comment</comments>
      <pubDate>Tue, 18 Jun 2024 15:33:07 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 칼럼 연산, 칼럼 위치지정 추가, 이름 변경 :: df.insert df.rename</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%B9%BC%EB%9F%BC-%EC%97%B0%EC%82%B0-%EC%B9%BC%EB%9F%BC-%EC%9C%84%EC%B9%98%EC%A7%80%EC%A0%95-%EC%B6%94%EA%B0%80-%EC%9D%B4%EB%A6%84-%EB%B3%80%EA%B2%BD-dfinsert-dfrename</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 데이터프레임 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼연산 테스트를 위한 데이터프레임을 불러오겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;Kaggle에서 가져온 Flight Price Prediction 데이터셋에서 칼럼 몇가지만 가져와볼게요.&lt;br /&gt;flight는 비행편, airline은 비행사이름, duration은 비행시간(hour), price는 비행편 티켓가격 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718688522317&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 데이터셋 불러오기
df = pd.read_csv(
    './Clean_Dataset.csv', 
    index_col = 'flight',  # 인덱스가 될 칼럼
    usecols = ['flight', 'airline', 'duration', 'price']  # 가져올 칼럼들 (인덱스 포함)
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1262&quot; data-origin-height=&quot;652&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/VlkYA/btsH2VvD2KZ/5VWfsejT3s1LX1bpkOGlJk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/VlkYA/btsH2VvD2KZ/5VWfsejT3s1LX1bpkOGlJk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/VlkYA/btsH2VvD2KZ/5VWfsejT3s1LX1bpkOGlJk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVlkYA%2FbtsH2VvD2KZ%2F5VWfsejT3s1LX1bpkOGlJk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1262&quot; height=&quot;652&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1262&quot; data-origin-height=&quot;652&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 기존칼럼 연산해서 새로운 칼럼 추가하기, 원하는 위치에 추가하기&amp;nbsp; ::&amp;nbsp; insert&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;duration 칼럼에 60을 곱해서 duration_min 칼럼을 추가해봤습니다.&lt;br /&gt;이렇게 단순하게 추가만 하면, &lt;b&gt;새롭게 생성된 칼럼은 무조건 맨 끝에 붙습니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;위치를 지정해서 칼럼을 추가&lt;/b&gt;하고 싶다면,&lt;span style=&quot;background-color: #dddddd;&quot;&gt; insert&lt;/span&gt; 를 사용해서 추가할 위치의 인덱스를 지정해주면 됩니다.&lt;br /&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.insert(추가할 위치 인덱스값, 새로운 칼럼명, 기존 칼럼 연산)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718689105965&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 기존칼럼을 연산해서 새로운 칼럼 추가하기
df['duration_min'] = df['duration'] * 60

# 위치 지정해서 칼럼 추가하기
df.insert(2, 'duration_min', df['duration']*60)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1265&quot; data-origin-height=&quot;908&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cUbwRi/btsH2OXFGN6/NqkiEHTki4kan1JIrQY9V1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cUbwRi/btsH2OXFGN6/NqkiEHTki4kan1JIrQY9V1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cUbwRi/btsH2OXFGN6/NqkiEHTki4kan1JIrQY9V1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcUbwRi%2FbtsH2OXFGN6%2FNqkiEHTki4kan1JIrQY9V1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1265&quot; height=&quot;908&quot; data-origin-width=&quot;1265&quot; data-origin-height=&quot;908&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 칼럼끼리 연산해서 새로운 칼럼 추가하기, 칼럼 이름 바꾸기&amp;nbsp; ::&amp;nbsp; rename&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;기존 칼럼들끼리 연산&lt;/b&gt;해서 새로운 칼럼을 추가할 수도 있습니다.&lt;br /&gt;price를 duration으로 나눠서 price_test 칼럼을 새롭게 추가해봤습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;만약 &lt;b&gt;칼럼 이름을 바꾸고&lt;/b&gt; 싶다면 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;rename&lt;/span&gt;을 사용하면 됩니다.&lt;br /&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;df.rename(columns = {'기존 칼럼명' : '바꿀 칼럼명'})&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718689469665&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 칼럼끼리 연산해서 새로운 칼럼 추가하기
df['price_test'] = df['price'] / df['duration']

# 칼럼 이름 변경하기
df = df.rename(columns={&quot;price_test&quot; : &quot;price_per_hour&quot;})&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1264&quot; data-origin-height=&quot;902&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ZzwgJ/btsH2JPRgVV/TBqFt6GcvPeTA6zxksBHjK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ZzwgJ/btsH2JPRgVV/TBqFt6GcvPeTA6zxksBHjK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ZzwgJ/btsH2JPRgVV/TBqFt6GcvPeTA6zxksBHjK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FZzwgJ%2FbtsH2JPRgVV%2FTBqFt6GcvPeTA6zxksBHjK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1264&quot; height=&quot;902&quot; data-origin-width=&quot;1264&quot; data-origin-height=&quot;902&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>df.insert</category>
      <category>df.rename</category>
      <category>pandas</category>
      <category>Python</category>
      <category>데이터프레임</category>
      <category>칼럼 이름변경</category>
      <category>칼럼연산</category>
      <category>칼럼추가</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/138</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%B9%BC%EB%9F%BC-%EC%97%B0%EC%82%B0-%EC%B9%BC%EB%9F%BC-%EC%9C%84%EC%B9%98%EC%A7%80%EC%A0%95-%EC%B6%94%EA%B0%80-%EC%9D%B4%EB%A6%84-%EB%B3%80%EA%B2%BD-dfinsert-dfrename#entry138comment</comments>
      <pubDate>Tue, 18 Jun 2024 14:47:33 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 특정 행열 선택 추출하기 :: loc iloc</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%ED%8A%B9%EC%A0%95-%ED%96%89%EC%97%B4-%EC%84%A0%ED%83%9D-%EC%B6%94%EC%B6%9C%ED%95%98%EA%B8%B0-loc-iloc</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 데이터프레임 생성&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;먼저 테스트를 위한 데이터프레임을 생성하겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718640069873&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd
import numpy as np

# 테스트용 데이터프레임 생성
df_test1 = pd.DataFrame({
    'A': [1,2,3,4,5,6,7,8,9,10],
    'B': [10,20,30,40,50,60,70,80,90,100],
    'C': [2,4,6,8,10,12,14,16,18,20],
    'D': [1,3,5,7,9,11,13,15,17,19],
    'E': [10,15,20,25,30,35,40,45,50,55]
})
df_test1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1131&quot; data-origin-height=&quot;506&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/l9CSD/btsH2ppTwex/DaAgEweZ7CdAEYzaSb5tRk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/l9CSD/btsH2ppTwex/DaAgEweZ7CdAEYzaSb5tRk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/l9CSD/btsH2ppTwex/DaAgEweZ7CdAEYzaSb5tRk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fl9CSD%2FbtsH2ppTwex%2FDaAgEweZ7CdAEYzaSb5tRk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1131&quot; height=&quot;506&quot; data-origin-width=&quot;1131&quot; data-origin-height=&quot;506&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 특정한 열 or 특정한 행만 선택하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;특정한 칼럼(열)&lt;/b&gt; 만 선택해서 출력하려면, 아래처럼&lt;b&gt; 대괄호 2개 안에 칼럼명&lt;/b&gt;을 넣어주면 됩니다.&lt;br /&gt;원하는 칼럼만 선택해서 원하는 순서대로 출력할 수 있습니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;(데이터프레임에 가위질을 여러번 할 수 있음!)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718640298310&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 특정 칼럼만 선택해서 출력하기 
df_test1[['칼럼명1', '칼럼명2', .. ,'칼럼명n']]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1269&quot; data-origin-height=&quot;629&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bz9dsO/btsH1hGgAXU/UelBiEJkE0gVASK7J1uMAk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bz9dsO/btsH1hGgAXU/UelBiEJkE0gVASK7J1uMAk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bz9dsO/btsH1hGgAXU/UelBiEJkE0gVASK7J1uMAk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbz9dsO%2FbtsH1hGgAXU%2FUelBiEJkE0gVASK7J1uMAk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1269&quot; height=&quot;629&quot; data-origin-width=&quot;1269&quot; data-origin-height=&quot;629&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;특정한 행(인덱스)&lt;/b&gt; 만 선택해서 출력하려면, 아래처럼 &lt;b&gt;대괄호 1개 안에 범위를 넣어서 슬라이싱&lt;/b&gt; 해줘야 합니다.&lt;br /&gt;칼럼과 다르게 연속적인 범위로만 선택할 수 있습니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;(데이터프레임에 가위질을 한번밖에 못함!)&lt;/span&gt;&lt;br /&gt;행 1개만 출력하고 싶어도, 아래처럼 범위로 넣지 않으면 에러가 발생합니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718682187443&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 슬라이싱: 특정 행범위를 선택해서 출력하기
# x번째 ~ y번째 행 출력하는 경우
df_test1[x-1 : y]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1275&quot; data-origin-height=&quot;598&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Zkgoi/btsH1Gsioe8/sbMn9KLtUKf01NRRErpipK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Zkgoi/btsH1Gsioe8/sbMn9KLtUKf01NRRErpipK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Zkgoi/btsH1Gsioe8/sbMn9KLtUKf01NRRErpipK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FZkgoi%2FbtsH1Gsioe8%2FsbMn9KLtUKf01NRRErpipK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1275&quot; height=&quot;598&quot; data-origin-width=&quot;1275&quot; data-origin-height=&quot;598&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 특정한 행열을 동시에 선택하기&amp;nbsp; ::&amp;nbsp; loc, iloc&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;행열 범위를 동시에 선택&lt;/b&gt;해서 데이터프레임을 잘라보고 싶은 경우라면, loc이나 iloc 메소드를 사용해야 합니다.&lt;br /&gt;- &lt;span style=&quot;background-color: #dddddd;&quot;&gt;loc&lt;/span&gt; : 행열에 &lt;b&gt;레이블&lt;/b&gt;로 접근합니다. 다시말해 사용자가 정해둔 인덱스명, 칼럼명으로 범위를 지정할 수 있습니다.&lt;br /&gt;- &lt;span style=&quot;background-color: #dddddd;&quot;&gt;iloc&lt;/span&gt; : 행열에 &lt;b&gt;인덱스값&lt;/b&gt;으로 접근합니다. 정해둔 이름이 아니라 &lt;b&gt;0 based index&lt;/b&gt; 값으로 범위를 지정해야 합니다.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 88.9535%; height: 104px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;loc&amp;nbsp;(location)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;iloc&amp;nbsp;(integer&amp;nbsp;location)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&amp;nbsp;행/열에&amp;nbsp;레이블로&amp;nbsp;접근하는&amp;nbsp;방법&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&amp;nbsp;인덱스&amp;nbsp;및&amp;nbsp;칼럼명으로&amp;nbsp;지정함&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&amp;nbsp;설정한&amp;nbsp;인덱스를&amp;nbsp;그대로&amp;nbsp;사용함&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 50%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&amp;nbsp;행/열에&amp;nbsp;인덱스값으로&amp;nbsp;접근하는&amp;nbsp;방법&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 인덱스로만 지정함&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&amp;nbsp;설정한&amp;nbsp;인덱스가&amp;nbsp;아닌,&amp;nbsp;0&amp;nbsp;based&amp;nbsp;index를&amp;nbsp;사용해야&amp;nbsp;함&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시를 참고하면 이해하기 더 쉬울 것 같습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터프레임의 인덱스를 101~110으로 지정해두었습니다. 따라서 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;loc&lt;/span&gt; 으로는 지정해둔 인덱스로 접근할 수 있습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;반면에 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;iloc&lt;/span&gt; 으로는 101~110 으로 접근하려하면 에러가 나고, &lt;span style=&quot;text-align: left;&quot;&gt;0 based index 로 접근해야만 합니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718640884227&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# loc 으로 행/열 선택하기 - 설정한 인덱스와 칼럼명 그대로 사용하면 됨
df_test2.loc[[101,103,105,110], ['A', 'B']]

# iloc으로 행/열 선택하기 - 0 based index 로 지정해줘야 함
df_test2.iloc[[0,2,4,9], [0,1]]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1268&quot; data-origin-height=&quot;1520&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bhqWHL/btsH2k9XRAO/z6NAkfJf5931QKJ9j0AOI1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bhqWHL/btsH2k9XRAO/z6NAkfJf5931QKJ9j0AOI1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bhqWHL/btsH2k9XRAO/z6NAkfJf5931QKJ9j0AOI1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbhqWHL%2FbtsH2k9XRAO%2Fz6NAkfJf5931QKJ9j0AOI1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1268&quot; height=&quot;1520&quot; data-origin-width=&quot;1268&quot; data-origin-height=&quot;1520&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 칼럼 조건 지정해서 데이터 추출하기&lt;/b&gt; (Boolean연산 - 논리연산, 비교연산)&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;칼럼별 값들에 대해 조건을 지정&lt;/b&gt;해서 데이터를 뽑아볼 수도 있습니다. 조건은 Boolean 연산으로 지정하면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;논리 연산: and , &amp;amp; , or , | , not , !=&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;비교 연산: is , is not , == , != , &amp;lt; , &amp;gt; , &amp;lt;= , &amp;gt;=&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1281&quot; data-origin-height=&quot;993&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bQd5tw/btsH2FeYZJj/puc5MAQmx7x1FbaR7H0OS0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bQd5tw/btsH2FeYZJj/puc5MAQmx7x1FbaR7H0OS0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bQd5tw/btsH2FeYZJj/puc5MAQmx7x1FbaR7H0OS0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbQd5tw%2FbtsH2FeYZJj%2Fpuc5MAQmx7x1FbaR7H0OS0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1281&quot; height=&quot;993&quot; data-origin-width=&quot;1281&quot; data-origin-height=&quot;993&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>iloc</category>
      <category>LOC</category>
      <category>pandas</category>
      <category>Python</category>
      <category>데이터프레임 열선택</category>
      <category>데이터프레임 행선택</category>
      <category>파이썬</category>
      <category>판다스</category>
      <category>행열선택</category>
      <category>행열추출</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/137</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%ED%8A%B9%EC%A0%95-%ED%96%89%EC%97%B4-%EC%84%A0%ED%83%9D-%EC%B6%94%EC%B6%9C%ED%95%98%EA%B8%B0-loc-iloc#entry137comment</comments>
      <pubDate>Tue, 18 Jun 2024 13:46:02 +0900</pubDate>
    </item>
    <item>
      <title>국내 AI 반도체 ETF 한번에 비교하기 (SOL AI반도체소부장, KODEX AI반도체핵심장비 등)</title>
      <link>https://sy-log.tistory.com/entry/%EA%B5%AD%EB%82%B4-AI-%EB%B0%98%EB%8F%84%EC%B2%B4-ETF-%ED%95%9C%EB%B2%88%EC%97%90-%EB%B9%84%EA%B5%90%ED%95%98%EA%B8%B0-SOL-AI%EB%B0%98%EB%8F%84%EC%B2%B4%EC%86%8C%EB%B6%80%EC%9E%A5-KODEX-AI%EB%B0%98%EB%8F%84%EC%B2%B4%ED%95%B5%EC%8B%AC%EC%9E%A5%EB%B9%84-%EB%93%B1</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;국내 AI 반도체 ETF 한번에 비교&lt;/b&gt; (24.06.14 장마감 기준)&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style5&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;순자산총액&amp;nbsp; 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;국내 반도체 AI 테마 ETF는 SOL, KODEX, TIGER, ACE에 하나씩 있습니다. &lt;/b&gt;국내 대표 ETF 운용사별로 하나씩은 있는 셈이네요.&lt;b&gt;&lt;br /&gt;모두 상장된지 1년 남짓 혹은 1년도 안된 상품들입니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이 중 &lt;b&gt;SOL AI반도체소부장&lt;/b&gt;의 순자산총액이 약 4천억으로, 운용규모가 가장 큰 ETF입니다.&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;523&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sF5d5/btsH1azeKwo/VLhQeRuEnMBo8xrhO8O1r0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sF5d5/btsH1azeKwo/VLhQeRuEnMBo8xrhO8O1r0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sF5d5/btsH1azeKwo/VLhQeRuEnMBo8xrhO8O1r0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsF5d5%2FbtsH1azeKwo%2FVLhQeRuEnMBo8xrhO8O1r0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1822&quot; height=&quot;523&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;523&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;nbsp;&lt;b&gt;&lt;/b&gt;&lt;b&gt;총보수율(TER), 실제부담비용율 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;총보수율(TER)&lt;/b&gt;은 일반적인 보수에 기타비용을 더한 비용인데요, 여기에 &lt;b&gt;수수료&lt;/b&gt;까지 더해야 &lt;b&gt;투자자가 실제로 부담하는 비용&lt;/b&gt;이 &lt;br /&gt;산출됩니다. &lt;b&gt;TIGER AI반도체핵심공정&lt;/b&gt;이 약 0.54%로 가장 높고, 그 다음 &lt;b&gt;SOL AI반도체소부장&lt;/b&gt;이 약 0.53% 로 큰 차이가 없네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;ACE AI반도체포커스&lt;/b&gt;는 약 0.38% 로 4개 상품 중에선 비교적 낮은 비용을 보여주고 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1824&quot; data-origin-height=&quot;523&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b5kaoA/btsHZTr6ceW/Wt4bQBkSGjdZOhbo5fUiik/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b5kaoA/btsHZTr6ceW/Wt4bQBkSGjdZOhbo5fUiik/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b5kaoA/btsHZTr6ceW/Wt4bQBkSGjdZOhbo5fUiik/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb5kaoA%2FbtsHZTr6ceW%2FWt4bQBkSGjdZOhbo5fUiik%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1824&quot; height=&quot;523&quot; data-origin-width=&quot;1824&quot; data-origin-height=&quot;523&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;국내 AI 반도체 ETF 수익률 한번에 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;SOL AI반도체소부장&lt;/b&gt;을 제외하면 전부 상장된지 1년이 안되었기 때문에, 최근 1년 수익률도 아직 없는 상태입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;올해 성장률(YTD)&lt;/b&gt;만 봐도 모두 20%를 넘기는 준수한 실적들을 보여주고 있습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그 중 &lt;b&gt;ACE AI반도체포커스&lt;/b&gt;의 수익률이 눈에 띄는데요, 운용규모는 가장 작지만 수익률은 상당하네요.&lt;br /&gt;나머지 3개 상품과 다른 점은, 포트폴리오에서 삼성전자와 SK하이닉스가 높은 비중을 차지한다는 점입니다.&lt;br /&gt;AI반도체포커스라는 이름에 걸맞게, 반도체 매출이 있는 종목의 3개월 평균 시가총액 및 거래대금을 반영해서 &lt;br /&gt;상위 20개 종목을 선정하기 때문입니다. 따라서 한미반도체, SK하이닉스, 삼성전자 TOP3에 집중투자하고 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 55px;&quot; border=&quot;1&quot; width=&quot;1488&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 15px;&quot;&gt;
&lt;td style=&quot;height: 15px; width: 40.2326%; text-align: center;&quot; colspan=&quot;2&quot; width=&quot;672&quot; height=&quot;121&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ETF 종목명&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 15px; width: 11.9767%; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1개월&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 15px; width: 11.9767%; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;3개월&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 15px; width: 11.9767%; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;6개월&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 15px; width: 11.9767%; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;YTD&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 15px; width: 11.9767%; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1년&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(%)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 10px;&quot;&gt;
&lt;td style=&quot;height: 10px; width: 5.23256%;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 35%;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SOL AI반도체소부장&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;3.28&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;10.65&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;20.51&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;20.20&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;46.37&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 10px;&quot;&gt;
&lt;td style=&quot;height: 10px; width: 5.23256%;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 35%;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;KODEX AI반도체핵심장비&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;4.67&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;18.64&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;39.59&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;40.89&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 10px;&quot;&gt;
&lt;td style=&quot;height: 10px; width: 5.23256%;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 35%;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;TIGER AI반도체핵심공정&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;6.31&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;20.19&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;37.62&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;37.90&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 10px;&quot;&gt;
&lt;td style=&quot;height: 10px; width: 5.23256%;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;4&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 35%;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ACE AI반도체포커스&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;13.68&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;32.83&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;64.46&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;55.98&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 10px; width: 11.9767%; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1743&quot; data-origin-height=&quot;829&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bLleL5/btsH0UQWJtP/S31YZpBkOKQvSDxuHkJViK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bLleL5/btsH0UQWJtP/S31YZpBkOKQvSDxuHkJViK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bLleL5/btsH0UQWJtP/S31YZpBkOKQvSDxuHkJViK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbLleL5%2FbtsH0UQWJtP%2FS31YZpBkOKQvSDxuHkJViK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1743&quot; height=&quot;829&quot; data-origin-width=&quot;1743&quot; data-origin-height=&quot;829&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;올해 수익률 추이를 비교해봤습니다. &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;포트폴리오가 조금씩 겹치니, 움직이는 폭은 다르지만 비슷한 양상으로 우상향하고 있는 모습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1055&quot; data-origin-height=&quot;790&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/myNdR/btsH0U4uDcv/stqvgkNq6TB6fEN4rIUR41/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/myNdR/btsH0U4uDcv/stqvgkNq6TB6fEN4rIUR41/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/myNdR/btsH0U4uDcv/stqvgkNq6TB6fEN4rIUR41/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmyNdR%2FbtsH0U4uDcv%2FstqvgkNq6TB6fEN4rIUR41%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1055&quot; height=&quot;790&quot; data-origin-width=&quot;1055&quot; data-origin-height=&quot;790&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;nbsp;&lt;b&gt;구성종목 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;SOL AI반도체소부장&lt;/b&gt;은 반도체 종합 생산기업을 제외하고 소재/부품/장비 기업으로만 구성한 국내최초 ETF입니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다시말해 SK하이닉스와 삼성전자는 빼고, 반도체에서 중요한 부분부분마다 핵심이 되는 관련주들을 넣은 포트폴리오입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;TIGER AI반도체핵심장비&lt;/b&gt; 는 AI반도체의 핵심인 HBM(고대역폭메모리) 관련종목에 집중투자하고 있고,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;KODEX AI반도체핵심공정&lt;/b&gt; 은 HBM관련종목 뿐만 아니라, 온디바이스 AI 관련종목에도 투자하고 있습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; 이와 같이 포트폴리오에 다소의 차이는 있지만, 아래 표에서 보시다시피 가장 비중이 높은 TOP3 종목은 동일합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;차트를 보시면 수익률 추이도 큰 차이가 없죠.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;ACE AI반도체포커스&lt;/b&gt;는 위에서도 언급했었죠. 공정/부품이 아니라, 시가총액과 거래대금으로 판단합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그래서 다른 ETF상품들과 포트폴리오가&amp;nbsp; 차이나는 모습입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;525&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cmDNbI/btsHZZeGKqM/tX4SS0l4xuc0KX0mYfkt81/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cmDNbI/btsHZZeGKqM/tX4SS0l4xuc0KX0mYfkt81/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cmDNbI/btsHZZeGKqM/tX4SS0l4xuc0KX0mYfkt81/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcmDNbI%2FbtsHZZeGKqM%2FtX4SS0l4xuc0KX0mYfkt81%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1822&quot; height=&quot;525&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;525&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;※ 투자 판단 및 의사결정으로 인한 책임은 투자자 본인에게 있습니다. 이 글은 단순 정리글이며 투자 권유글이 아닙니다.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>위키/경제&amp;amp;투자</category>
      <category>ai반도체etf</category>
      <category>ETF</category>
      <category>ETF비교</category>
      <category>etf정리</category>
      <category>국내ETF</category>
      <category>국내반도체ETF</category>
      <category>반도체ETF</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/135</guid>
      <comments>https://sy-log.tistory.com/entry/%EA%B5%AD%EB%82%B4-AI-%EB%B0%98%EB%8F%84%EC%B2%B4-ETF-%ED%95%9C%EB%B2%88%EC%97%90-%EB%B9%84%EA%B5%90%ED%95%98%EA%B8%B0-SOL-AI%EB%B0%98%EB%8F%84%EC%B2%B4%EC%86%8C%EB%B6%80%EC%9E%A5-KODEX-AI%EB%B0%98%EB%8F%84%EC%B2%B4%ED%95%B5%EC%8B%AC%EC%9E%A5%EB%B9%84-%EB%93%B1#entry135comment</comments>
      <pubDate>Mon, 17 Jun 2024 01:51:10 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 칼럼 값들의 개수 빈도수 카운트 :: value_counts value counts</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%B9%BC%EB%9F%BC-%EA%B0%92%EB%93%A4%EC%9D%98-%EA%B0%9C%EC%88%98-%EB%B9%88%EB%8F%84%EC%88%98-%EC%B9%B4%EC%9A%B4%ED%8A%B8-valuecounts-value-counts</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 칼럼에 있는 값들의 개수&amp;nbsp; ::&amp;nbsp; value_counts&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;특정 칼럼에 포함된 값들의 구성&lt;/b&gt;을 알고 싶을 때, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;value_counts&lt;/span&gt; 메소드를 유용하게 사용할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼을 지정하면, 이 칼럼에 있는 모든 고유값들의 개수(counts)를 돌려주는 메소드입니다.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시 데이터셋은 Kaggle에서 가져온 Flight Price Prediction 비행편 데이터셋인데요, &lt;br /&gt;출발시간(departure_time)칼럼에 포함된 데이터가 각각 몇 개인지 뽑아봤습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718533732980&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 지정한 칼럼에 있는 모든 고유값들의 개수(counts)
df['칼럼명'].value_counts()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1261&quot; data-origin-height=&quot;709&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/45Pw7/btsH0ZR4Wtf/pS42nyqK9uNTc9fenRaiF0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/45Pw7/btsH0ZR4Wtf/pS42nyqK9uNTc9fenRaiF0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/45Pw7/btsH0ZR4Wtf/pS42nyqK9uNTc9fenRaiF0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F45Pw7%2FbtsH0ZR4Wtf%2FpS42nyqK9uNTc9fenRaiF0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1261&quot; height=&quot;709&quot; data-origin-width=&quot;1261&quot; data-origin-height=&quot;709&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 내림차순 정렬 없애기&amp;nbsp; ::&amp;nbsp; sort=False&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;위 결과테이블을 보시면 counts 기준 &lt;b&gt;내림차순으로 정렬&lt;/b&gt;되어 있습니다. &lt;b&gt;디폴트로 정렬&lt;/b&gt;되어 출력되는 거죠.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;sort&lt;/span&gt; 파라미터를 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;False&lt;/span&gt;로 두면 정렬을 없애고 출력시킬 수 있습니다.&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718535152713&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df['칼럼명'].value_counts(sort=False)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1114&quot; data-origin-height=&quot;308&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/vahMk/btsH1NDuYNy/BxNjDOuSu6NkhCXvrMkfz1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/vahMk/btsH1NDuYNy/BxNjDOuSu6NkhCXvrMkfz1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/vahMk/btsH1NDuYNy/BxNjDOuSu6NkhCXvrMkfz1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FvahMk%2FbtsH1NDuYNy%2FBxNjDOuSu6NkhCXvrMkfz1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1114&quot; height=&quot;308&quot; data-origin-width=&quot;1114&quot; data-origin-height=&quot;308&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 오름차순 정렬하기&amp;nbsp; ::&amp;nbsp; ascending=True&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;내림차순 말고 &lt;b&gt;오름차순으로 정렬&lt;/b&gt;하고 싶다면, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;ascending&lt;/span&gt; 파라미터를 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;True&lt;/span&gt;로 두면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;오름차순 정렬한 데이터를 &lt;b&gt;막대그래프&lt;/b&gt;로 시각화해봤습니다. 빈도수 차이가 한눈에 보이네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718535322393&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df['칼럼명'].value_counts(ascending=True)
df['칼럼명'].value_counts(ascending=True).plot(kind='bar')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1278&quot; data-origin-height=&quot;1153&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/6RsB4/btsH1EGD4ZQ/aBhbfwA1HK0HpRZFfcpQmK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/6RsB4/btsH1EGD4ZQ/aBhbfwA1HK0HpRZFfcpQmK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/6RsB4/btsH1EGD4ZQ/aBhbfwA1HK0HpRZFfcpQmK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6RsB4%2FbtsH1EGD4ZQ%2FaBhbfwA1HK0HpRZFfcpQmK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1278&quot; height=&quot;1153&quot; data-origin-width=&quot;1278&quot; data-origin-height=&quot;1153&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 빈도수 대신 비율로 보기&amp;nbsp; ::&amp;nbsp; normalize=True&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;normalize&lt;/span&gt; 파라미터를 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;True&lt;/span&gt;로 두면 빈도수 값들이 &lt;b&gt;정규화&lt;/b&gt;됩니다.&lt;br /&gt;전부 합치면 1이되는 소수들이 되는데, 다시말해 &lt;b&gt;비율(%)로 변환&lt;/b&gt;해서 볼 수 있다는 거죠.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래 예시를 보시면 출발시간 중 아침에 해당하는 건 약 23.7% 로 가장 많았고, 심야는 약 0.4%로 가장 적었네요.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;정규화값을 오름차순 정렬하고, &lt;b&gt;파이차트&lt;/b&gt;를 그려서 눈에 더 잘 들어오게 시각화 해봤습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718536267276&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df['칼럼명'].value_counts(normalize=True)
df['칼럼명'].value_counts(normalize=True, ascending=True)
df['칼럼명'].value_counts(normalize=True, ascending=True).plot(kind='pie')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1274&quot; data-origin-height=&quot;1212&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cjrMvB/btsHZ5Z35Yb/9zDH4FK3dLQIv9Ow1V9LKK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cjrMvB/btsHZ5Z35Yb/9zDH4FK3dLQIv9Ow1V9LKK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cjrMvB/btsHZ5Z35Yb/9zDH4FK3dLQIv9Ow1V9LKK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcjrMvB%2FbtsHZ5Z35Yb%2F9zDH4FK3dLQIv9Ow1V9LKK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1274&quot; height=&quot;1212&quot; data-origin-width=&quot;1274&quot; data-origin-height=&quot;1212&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣&amp;nbsp; 인덱스 기준으로 정렬하기&amp;nbsp; ::&amp;nbsp; sort_index()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;빈도수 기준이 아니라 &lt;b&gt;인덱스 순서대로 정렬&lt;/b&gt;하고 싶을 때는 어떻게 해야 할까요?&lt;br /&gt;파라미터를 넣는대신, 끝에 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;.sort_index()&lt;/span&gt;를 추가하는 방식으로 정렬해볼 수 있습니다.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래처럼 인덱스가 정렬됩니다.&lt;br /&gt;- 해당 칼럼이 &lt;b&gt;범주형&lt;/b&gt; 데이터라면: 인덱스가 &lt;b&gt;문자열이므로 알파벳 A~Z 순서대로 정렬&lt;/b&gt;&lt;br /&gt;- 해당 칼럼이 &lt;b&gt;수치형&lt;/b&gt; 데이터라면: 인덱스가 &lt;b&gt;숫자이므로 작은 숫자부터 오름차순 정렬&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예시로 뽑아본 수치형 데이터 칼럼 'price'는 고유값이 너무 많아서 보이지도 않네요. &lt;br /&gt;&lt;b&gt;히스토그램&lt;/b&gt;으로 시각화해보았습니다. 대부분의 가격이 0~200 사이에 형성되어 있다는 걸 알 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718536646036&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df['칼럼명'].value_counts().sort_index()
df['칼럼명'].value_counts().sort_index().plot(kind='hist')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1185&quot; data-origin-height=&quot;1455&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bNylVy/btsH1piyTMc/gh193bpN6Lc1dMLE5Keb50/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bNylVy/btsH1piyTMc/gh193bpN6Lc1dMLE5Keb50/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bNylVy/btsH1piyTMc/gh193bpN6Lc1dMLE5Keb50/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbNylVy%2FbtsH1piyTMc%2Fgh193bpN6Lc1dMLE5Keb50%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1185&quot; height=&quot;1455&quot; data-origin-width=&quot;1185&quot; data-origin-height=&quot;1455&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;5️⃣&amp;nbsp; 결과를 데이터프레임으로 보기&amp;nbsp; ::&amp;nbsp; to_frame()&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;지금까지 뽑아본 빈도수 테이블은 Series 형태로 출력되었습니다.&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;좀더 보기 쉽게 만들거나 혹은, csv파일 등으로 추출하려면 &lt;b&gt;데이터프레임으로 변환&lt;/b&gt;하는게 낫겠습니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;끝에 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;.to_frame()&lt;/span&gt; 을 추가해서 데이터프레임으로 출력시킬 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718537490269&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df['칼럼명'].value_counts().to_frame()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1245&quot; data-origin-height=&quot;900&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/GjkcS/btsHZ5eGBAy/ptnpNTaAf8nLknhDMqdYVK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/GjkcS/btsHZ5eGBAy/ptnpNTaAf8nLknhDMqdYVK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/GjkcS/btsHZ5eGBAy/ptnpNTaAf8nLknhDMqdYVK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FGjkcS%2FbtsHZ5eGBAy%2FptnpNTaAf8nLknhDMqdYVK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1245&quot; height=&quot;900&quot; data-origin-width=&quot;1245&quot; data-origin-height=&quot;900&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>pandas</category>
      <category>Python</category>
      <category>value counts</category>
      <category>value_counts</category>
      <category>데이터프레임 빈도</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/134</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%B9%BC%EB%9F%BC-%EA%B0%92%EB%93%A4%EC%9D%98-%EA%B0%9C%EC%88%98-%EB%B9%88%EB%8F%84%EC%88%98-%EC%B9%B4%EC%9A%B4%ED%8A%B8-valuecounts-value-counts#entry134comment</comments>
      <pubDate>Sun, 16 Jun 2024 20:36:10 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 요약 기본정보 요약통계량 확인하기 :: info describe columns dtypes</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%9A%94%EC%95%BD-%EA%B8%B0%EB%B3%B8%EC%A0%95%EB%B3%B4-%EC%9A%94%EC%95%BD%ED%86%B5%EA%B3%84%EB%9F%89-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0-info-describe-columns-dtypes</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; DataFrame 형태, 칼럼이름, 칼럼별 데이터타입&amp;nbsp; ::&amp;nbsp; shape, columns, dtypes&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;몇천 몇만 행짜리 데이터프레임을 불러오면, 이 데이터가 어떻게 생겼는지 등등 기본정보와 요약을 먼저 살펴봐야 합니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;가장 먼저 살펴볼 법한 데이터프레임의 기본중의 기본정보 3가지 입니다.&lt;br /&gt;- &lt;span style=&quot;background-color: #dddddd;&quot;&gt;shape&lt;/span&gt; : 데이터프레임의 형태 = 행열의 개수&lt;br /&gt;- &lt;span style=&quot;background-color: #dddddd;&quot;&gt;columns&lt;/span&gt; : 칼럼들의 이름&lt;br /&gt;- &lt;span style=&quot;background-color: #dddddd;&quot;&gt;dtypes&lt;/span&gt; : 각 칼럼의 데이터타입&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718521538438&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df.shape    # 데이터프레임의 형태
df.columns  # 칼럼들의 이름
df.dtypes   # 각 칼럼의 데이터타입&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1164&quot; data-origin-height=&quot;1010&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dEttAk/btsH1iDMNYY/RcSrxPvS6vmqT90SGVqRL1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dEttAk/btsH1iDMNYY/RcSrxPvS6vmqT90SGVqRL1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dEttAk/btsH1iDMNYY/RcSrxPvS6vmqT90SGVqRL1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdEttAk%2FbtsH1iDMNYY%2FRcSrxPvS6vmqT90SGVqRL1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1164&quot; height=&quot;1010&quot; data-origin-width=&quot;1164&quot; data-origin-height=&quot;1010&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; DataFrame 칼럼별 상태 확인하기&amp;nbsp; ::&amp;nbsp; info&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;info&lt;/span&gt; 메소드를 활용하면, 각 칼럼별로 상태를 간단하게 확인할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;칼럼별로 데이터는 몇개 들어가 있는지, 결측치가 있는지, 데이터타입은 무엇인지 확인 가능합니다.&lt;br /&gt;- 테스트해보려고 아래처럼 일부러 결측치를 넣어봤는데요, Non-Null Count가 달라지는 것을 볼 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718523606427&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df.info()  # 칼럼별 상태확인&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1068&quot; data-origin-height=&quot;1076&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bXQ6JW/btsH18m26cW/Cl4znIK2xaZdWG5RcuD8kk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bXQ6JW/btsH18m26cW/Cl4znIK2xaZdWG5RcuD8kk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bXQ6JW/btsH18m26cW/Cl4znIK2xaZdWG5RcuD8kk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbXQ6JW%2FbtsH18m26cW%2FCl4znIK2xaZdWG5RcuD8kk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1068&quot; height=&quot;1076&quot; data-origin-width=&quot;1068&quot; data-origin-height=&quot;1076&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; DataFrame 칼럼별 요약통계량 확인하기&amp;nbsp; ::&amp;nbsp; describe&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle; color: #333333; text-align: left;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;describe&lt;/span&gt; 메소드를 사용해서 칼럼별 요약통계량들을 집계할 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;list-style-type: circle; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;칼럼이 수치형데이터인지, 범주형데이터인지에 따라 다른 통계량을 보여줍니다.&lt;b&gt;&lt;br /&gt;&lt;/b&gt;- 수치형: 데이터 카운트, 평균값, 표준편차, 최솟값, 최댓값, 사분위값&lt;br /&gt;- 범주형: 데이터 카운트, 최빈값, 최빈값의 개수&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718524588333&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df.describe()
df.describe(include='all')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1577&quot; data-origin-height=&quot;1183&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bTr29t/btsH0VCbGLu/cZJ2wNcCu7dTVBN7g2VW01/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bTr29t/btsH0VCbGLu/cZJ2wNcCu7dTVBN7g2VW01/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bTr29t/btsH0VCbGLu/cZJ2wNcCu7dTVBN7g2VW01/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbTr29t%2FbtsH0VCbGLu%2FcZJ2wNcCu7dTVBN7g2VW01%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1577&quot; height=&quot;1183&quot; data-origin-width=&quot;1577&quot; data-origin-height=&quot;1183&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>columns</category>
      <category>describe</category>
      <category>dtypes</category>
      <category>info</category>
      <category>pandas</category>
      <category>Python</category>
      <category>데이터프레임 기본정보</category>
      <category>데이터프레임 요약</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/133</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EC%9A%94%EC%95%BD-%EA%B8%B0%EB%B3%B8%EC%A0%95%EB%B3%B4-%EC%9A%94%EC%95%BD%ED%86%B5%EA%B3%84%EB%9F%89-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0-info-describe-columns-dtypes#entry133comment</comments>
      <pubDate>Sun, 16 Jun 2024 17:07:28 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 시리즈Series, 데이터프레임DataFrame 생성하기</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EC%8B%9C%EB%A6%AC%EC%A6%88Series-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84DataFrame-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; Pandas Series 생성하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;판다스&lt;/span&gt;는 테이블 형태의 데이터를 다루는 라이브러리입니다. &lt;/b&gt;그래서 헷갈릴 때는&amp;nbsp;&lt;b&gt;엑셀&lt;/b&gt; 테이블을 생각하면 도움이 되더라구요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;판다스 시리즈Series&lt;/span&gt;는 칼럼(열) 1개짜리 테이블이라고 생각하면 됩니다.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;시리즈를 생성할 때는 들어갈 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;data, index&lt;/span&gt;를 지정해주어야 합니다. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;name&lt;/span&gt;으로 이름을 정할수도 있습니다.&lt;br /&gt;참고로 Series 의 대소문자는 꼭 맞게 입력해주어야 합니다!&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;출력해보면, 아래와 같이 index, data가 입력한 순서대로 세로로 출력됩니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718445313322&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import pandas as pd

series_1 = pd.Series(
    data = ['고양이', '강아지', '햄스터'],
    index = ['a', 'b', 'c'],
    name = '귀여운 동물 친구들'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1181&quot; data-origin-height=&quot;424&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/oUo6t/btsH0OJJzq2/ObMuG83E6qhAnfMlfUEjkK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/oUo6t/btsH0OJJzq2/ObMuG83E6qhAnfMlfUEjkK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/oUo6t/btsH0OJJzq2/ObMuG83E6qhAnfMlfUEjkK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FoUo6t%2FbtsH0OJJzq2%2FObMuG83E6qhAnfMlfUEjkK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1181&quot; height=&quot;424&quot; data-origin-width=&quot;1181&quot; data-origin-height=&quot;424&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; Pandas DataFrame 생성 (1) - 딕셔너리 형태로 생성하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;판다스 데이터프레임DataFrame&lt;/span&gt;은 칼럼(열) n개짜리 테이블이라고 볼 수 있습니다.&lt;/b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터프레임을 생성하는 첫번째 방법은 &lt;b&gt;딕셔너리를 pd.DataFrame으로 감싸는 형식&lt;/b&gt;으로 생성해주는 방법입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이때 key값들은 칼럼명이 되고, 각 value들은 칼럼별 값들로 들어가게 됩니다.&lt;br /&gt;다시말해 &lt;b&gt;key-value 한 쌍이 데이터프레임에서 한 칼럼(열)&lt;/b&gt; 입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;여기서&amp;nbsp;value로&amp;nbsp;들어가는&amp;nbsp;리스트들의&amp;nbsp;&lt;b&gt;길이가&amp;nbsp;모두&amp;nbsp;같아야&amp;nbsp;&lt;/b&gt;합니다.&amp;nbsp;길이&amp;nbsp;다른&amp;nbsp;리스트가&amp;nbsp;하나라도&amp;nbsp;있으면&amp;nbsp;에러가&amp;nbsp;떠요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718466268854&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df_1 = pd.DataFrame({
    'a': [1,2,3], 
    'b': [10,20,30], 
    'c': [10,100,1000]
})&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1153&quot; data-origin-height=&quot;425&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bMMYVr/btsH0P9MTJT/BK971LxrTAqOtxLoxwV7d0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bMMYVr/btsH0P9MTJT/BK971LxrTAqOtxLoxwV7d0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bMMYVr/btsH0P9MTJT/BK971LxrTAqOtxLoxwV7d0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbMMYVr%2FbtsH0P9MTJT%2FBK971LxrTAqOtxLoxwV7d0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1153&quot; height=&quot;425&quot; data-origin-width=&quot;1153&quot; data-origin-height=&quot;425&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;리스트 대신&lt;span style=&quot;background-color: #dddddd;&quot;&gt; pd.Series&lt;/span&gt;로 넣어줘도 문제없습니다.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;만약 Series 길이가 다른 리스트의 길이와 다르다면, 값이 들어갈 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;index&lt;/span&gt;를 지정해서 빈곳을 두고 만들 수도 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718468329273&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;dict = {
    'a': [1,2,3],
    'b': pd.Series([10,20,30]),
    'c': pd.Series([10,100,1000])
}
df_2 = pd.DataFrame(dict)

dict = {
    'a': [1,2,3],
    'b': pd.Series([20,30], index=[2,3]),
    'c': pd.Series([10], index=[1])
}
df_3 = pd.DataFrame(dict, index=[1,2,3])&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1185&quot; data-origin-height=&quot;845&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bS1mUs/btsH0nZ65SX/7wUkPl9qNoXMk0qulMhuwK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bS1mUs/btsH0nZ65SX/7wUkPl9qNoXMk0qulMhuwK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bS1mUs/btsH0nZ65SX/7wUkPl9qNoXMk0qulMhuwK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbS1mUs%2FbtsH0nZ65SX%2F7wUkPl9qNoXMk0qulMhuwK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1185&quot; height=&quot;845&quot; data-origin-width=&quot;1185&quot; data-origin-height=&quot;845&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; Pandas DataFrame 생성 (2) - 리스트 형태로 생성하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;두번째 방법은 리스트 1~3개로 데이터프레임을 생성하는 방법입니다.&lt;/b&gt;&lt;br /&gt;- 1번째 리스트: 셀에 들어갈 값들을 이중리스트로 넣어야 함&lt;br /&gt;- 2번째 리스트: 인덱스(행) 이름으로 들어감&lt;br /&gt;- 3번째 리스트: &lt;span style=&quot;text-align: left;&quot;&gt;칼럼(열) 이름으로 들어감&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1번째 이중리스트 안의 &lt;b&gt;내부리스트 각각이 하나의 행&lt;/b&gt;이 됩니다. 즉, 위에서 딕셔너리로 만들 때랑 반대라고 볼 수 있네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;참고로 2, 3번째 리스트를 지정하지 않아도 데이터프레임은 생성됩니다.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718467032318&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;df_4 = pd.DataFrame(
    [[1,2,3], [10,20,30], [10,100,1000]],  # 들어갈 값들
    ['a','b','c'],  # 인덱스 이름
    ['x','y','z']   # 칼럼 이름
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1139&quot; data-origin-height=&quot;775&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cAYvZ5/btsHZMGmgFB/KxLSQafH8YnsIJs0e94wpk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cAYvZ5/btsHZMGmgFB/KxLSQafH8YnsIJs0e94wpk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cAYvZ5/btsHZMGmgFB/KxLSQafH8YnsIJs0e94wpk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcAYvZ5%2FbtsHZMGmgFB%2FKxLSQafH8YnsIJs0e94wpk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1139&quot; height=&quot;775&quot; data-origin-width=&quot;1139&quot; data-origin-height=&quot;775&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; Pandas DataFrame 생성 (3) - np.array 넣어서 생성하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;위 두번째 방법의 &lt;b&gt;리스트 대신, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;numpy array&lt;/span&gt;가 들어가는 방법&lt;/b&gt;입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;마찬가지로 np.array 하나가 데이터프레임의 &lt;b&gt;행 하나&lt;/b&gt;로 들어갑니다.&lt;br /&gt;np.array를 리스트나 다른 데이터타입으로 변환할 필요없이 바로 데이터프레임을 만들 수 있다는 점이 좋은 부분이네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718469694507&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import numpy as np

df_6 = pd.DataFrame(
    np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
    columns=['a','b','c']
)
df_6&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1091&quot; data-origin-height=&quot;427&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bF4TFZ/btsHZKu0yjF/Ywk0qxF9bofe73510OfHLk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bF4TFZ/btsHZKu0yjF/Ywk0qxF9bofe73510OfHLk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bF4TFZ/btsHZKu0yjF/Ywk0qxF9bofe73510OfHLk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbF4TFZ%2FbtsHZKu0yjF%2FYwk0qxF9bofe73510OfHLk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1091&quot; height=&quot;427&quot; data-origin-width=&quot;1091&quot; data-origin-height=&quot;427&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>DataFrame</category>
      <category>pandas</category>
      <category>pd.dataframe</category>
      <category>pd.Series</category>
      <category>Python</category>
      <category>데이터프레임</category>
      <category>시리즈</category>
      <category>파이썬</category>
      <category>판다스</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/132</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EC%8B%9C%EB%A6%AC%EC%A6%88Series-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84DataFrame-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0#entry132comment</comments>
      <pubDate>Sun, 16 Jun 2024 01:50:25 +0900</pubDate>
    </item>
    <item>
      <title>[Pandas] 데이터프레임 교차표 분석하기 :: Crosstab</title>
      <link>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B5%90%EC%B0%A8%ED%91%9C-%EB%B6%84%EC%84%9D%ED%95%98%EA%B8%B0-Crosstab</link>
      <description>&lt;h3 style=&quot;text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;Pandas Crosstab 함수로 교차표 분석하고, 시각화까지 해보기!&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style5&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 라이브러리 및 데이터셋 불러오기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;캐글 Flight Price Prediction의 Clean_Dataset으로 테스트해보겠습니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(캐글 데이터 다운로드: &lt;a style=&quot;color: #000000;&quot; href=&quot;https://www.kaggle.com/datasets/shubhambathwal/flight-price-prediction&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://www.kaggle.com/datasets/shubhambathwal/flight-price-prediction&lt;/a&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;데이터 구성을 보면 항공사, 비행편, 출발도시 및 시간, 도착도시, 비행시간, 티켓가격 등으로 이루어져 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718374355773&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 라이브러리 불러오기
import pandas as pd
import numpy as np

# 데이터셋 가져와서 확인해보기
df_clean = pd.read_csv('./Clean_Dataset.csv', encoding='cp949')
df_clean&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1473&quot; data-origin-height=&quot;695&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/oYig3/btsH02Oh9N5/E1yWqzTImJFQgKpY7JiaW0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/oYig3/btsH02Oh9N5/E1yWqzTImJFQgKpY7JiaW0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/oYig3/btsH02Oh9N5/E1yWqzTImJFQgKpY7JiaW0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FoYig3%2FbtsH02Oh9N5%2FE1yWqzTImJFQgKpY7JiaW0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1473&quot; height=&quot;695&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1473&quot; data-origin-height=&quot;695&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-1.&amp;nbsp; 범주형 데이터 2개로 교차표 만들기 (crosstab)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;pd.crosstab&lt;/span&gt; 함수로 교차표를 만들 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;index&lt;/span&gt;에 행이 될 칼럼의 이름, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;columns&lt;/span&gt;에 열이 될 칼럼의 이름을 넣어주시면 됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718375195294&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# crosstab으로 범주형 데이터 2개에 대한 교차표 만들기
pd.crosstab(
    index = df_clean['source_city'], 
    columns = df_clean['destination_city']
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1261&quot; data-origin-height=&quot;612&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/LwGFI/btsH0iRUHhm/Dh3jfW0fl2ns1BsKWTMDq1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/LwGFI/btsH0iRUHhm/Dh3jfW0fl2ns1BsKWTMDq1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/LwGFI/btsH0iRUHhm/Dh3jfW0fl2ns1BsKWTMDq1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLwGFI%2FbtsH0iRUHhm%2FDh3jfW0fl2ns1BsKWTMDq1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1261&quot; height=&quot;612&quot; data-origin-width=&quot;1261&quot; data-origin-height=&quot;612&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-2.&amp;nbsp; 교차표에 행/열별로 합계 추가하기 (subtotal, margins)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;pd.crosstab&lt;/span&gt; 함수에 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;margins = True&lt;/span&gt; 파라미터를 추가해서, 아래와 같이 행/열별로 합계를 볼 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1282&quot; data-origin-height=&quot;646&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ck0EpH/btsH0NRnHh8/kYAKrwcgQWDKiPdXkXFDR1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ck0EpH/btsH0NRnHh8/kYAKrwcgQWDKiPdXkXFDR1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ck0EpH/btsH0NRnHh8/kYAKrwcgQWDKiPdXkXFDR1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fck0EpH%2FbtsH0NRnHh8%2FkYAKrwcgQWDKiPdXkXFDR1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1282&quot; height=&quot;646&quot; data-origin-width=&quot;1282&quot; data-origin-height=&quot;646&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣-3.&amp;nbsp; 교차표에 나오는 값들을 정규화하기 (normalize)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;교차표를 만들어도 값들이 너무 많고 제각각이라서 비교하기 힘들다면, 정규화하는 것도 방법 중에 하나입니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;normalize = True 파라미터를 추가하면, 표의 값들이 전부 0~1 사이의 값으로 정규화됩니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1296&quot; data-origin-height=&quot;643&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/CViA2/btsH0yz8P6z/WXNFGIiAPcpHT6hb9pUP40/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/CViA2/btsH0yz8P6z/WXNFGIiAPcpHT6hb9pUP40/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/CViA2/btsH0yz8P6z/WXNFGIiAPcpHT6hb9pUP40/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FCViA2%2FbtsH0yz8P6z%2FWXNFGIiAPcpHT6hb9pUP40%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1296&quot; height=&quot;643&quot; data-origin-width=&quot;1296&quot; data-origin-height=&quot;643&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 교차표에 나오는 값들을 차트로 시각화하기 (plot)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;특정변수에 교차표를 넣고, 이 변수에 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;plot&lt;/span&gt; 함수를 사용해서 차트를 그릴 수 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;범주형 데이터이므로, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;kind = 'bar'&lt;/span&gt; 파라미터를 넣어서 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;막대그래프&lt;/span&gt;를 그렸습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그냥 막대그래프는 눈에 잘 안들어오네요.. &lt;span style=&quot;background-color: #dddddd;&quot;&gt;stacked = True&lt;/span&gt; 파라미터를 추가해 누적 막대그래프로 변경했습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718376597724&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 교차표 생성
ct_1 = pd.crosstab(
    index = df_clean['source_city'], 
    columns = df_clean['destination_city']
)

# 막대그래프 그리기
ct_1.plot(kind = 'bar')

# 누적 막대그래프 그리기
ct_1.plot(kind = 'bar', stacked = True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;968&quot; data-origin-height=&quot;1548&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bLcvIm/btsHZ6RIz40/K3wySObYyAC0zjK86wrqW1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bLcvIm/btsHZ6RIz40/K3wySObYyAC0zjK86wrqW1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bLcvIm/btsHZ6RIz40/K3wySObYyAC0zjK86wrqW1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbLcvIm%2FbtsHZ6RIz40%2FK3wySObYyAC0zjK86wrqW1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;968&quot; height=&quot;1548&quot; data-origin-width=&quot;968&quot; data-origin-height=&quot;1548&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣.&amp;nbsp; 교차표에서 수치형 데이터 값 집계하기 (Aggregation)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;교차표 자체는 범주형데이터 2개를 교차해서 만들지만, 내용을 수치형 데이터의 집계값으로 넣을 수 있습니다.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;아래처럼 행은 출발도시, 열은 도착도시로 두고, &lt;b&gt;각 셀에 넣을 값들은 티켓가격의 평균값&lt;/b&gt;으로 설정해보았습니다.&lt;br /&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;values&lt;/span&gt; 파라미터에 집계할 수치데이터 칼럼을 넣고, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;aggfunc = 'mean'&lt;/span&gt; 으로 지정했습니다.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;aggfunc 파라미터는 'mean', 'median', 'sum', 'max', 'min', 'std', 'var' 등으로 다양하게 넣을 수 있습니다.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718378025058&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 데이터프레임 내 숫자 포맷 고정하기 (소수점 아래 2자리까지)
pd.options.display.float_format = '{:,.2f}'.format

# 출발-도착도시별로 티켓가격 평균 확인하기
pd.crosstab(
    index = df_clean['source_city'],
    columns = df_clean['destination_city'],
    values = df_clean['price'], 
    aggfunc = 'mean'
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1250&quot; data-origin-height=&quot;722&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/wmfWX/btsH1jhYgxF/8F63Ivc8jsRLSg3GBKAZZ1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/wmfWX/btsH1jhYgxF/8F63Ivc8jsRLSg3GBKAZZ1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/wmfWX/btsH1jhYgxF/8F63Ivc8jsRLSg3GBKAZZ1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FwmfWX%2FbtsH1jhYgxF%2F8F63Ivc8jsRLSg3GBKAZZ1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1250&quot; height=&quot;722&quot; data-origin-width=&quot;1250&quot; data-origin-height=&quot;722&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;4️⃣&amp;nbsp; &lt;/b&gt;&lt;b&gt;교차표로 히트맵 그리기 (heatmap)&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;seaborn&lt;/span&gt; 라이브러리를 활용해서 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;히트맵&lt;/span&gt;까지 그려보겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;히트맵을 그리니까 확실히 한눈에 비교되네요!&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718378235040&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import seaborn as sns

# 교차표 생성해서 변수에 넣기
ct_2 = pd.crosstab(
    index = df_clean['source_city'],
    columns = df_clean['destination_city'],
    values = df_clean['price'], 
    aggfunc = 'mean'
)

# 히트맵 그리기
sns.heatmap(ct_2, cmap = 'coolwarm', annot = True)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;1064&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nBqbg/btsH0XsOFI3/xL3u1aPgcwDBjcURp5aY9K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nBqbg/btsH0XsOFI3/xL3u1aPgcwDBjcURp5aY9K/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nBqbg/btsH0XsOFI3/xL3u1aPgcwDBjcURp5aY9K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnBqbg%2FbtsH0XsOFI3%2FxL3u1aPgcwDBjcURp5aY9K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1280&quot; height=&quot;1064&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;1064&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>crosstab</category>
      <category>pandas</category>
      <category>Python</category>
      <category>교차표</category>
      <category>교차표 시각화</category>
      <category>파이썬</category>
      <category>판다스</category>
      <category>히트맵</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/131</guid>
      <comments>https://sy-log.tistory.com/entry/Pandas-%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%94%84%EB%A0%88%EC%9E%84-%EA%B5%90%EC%B0%A8%ED%91%9C-%EB%B6%84%EC%84%9D%ED%95%98%EA%B8%B0-Crosstab#entry131comment</comments>
      <pubDate>Sat, 15 Jun 2024 00:22:33 +0900</pubDate>
    </item>
    <item>
      <title>AICE Associate AI자격증 시험 출제범위 정리</title>
      <link>https://sy-log.tistory.com/entry/AICE-Associate-AI%EC%9E%90%EA%B2%A9%EC%A6%9D-%EC%8B%9C%ED%97%98-%EC%B6%9C%EC%A0%9C%EB%B2%94%EC%9C%84-%EC%A0%95%EB%A6%AC</link>
      <description>&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;nbsp; &lt;b&gt;AICE 개요&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;인공지능 활용능력을 평가하는 &lt;b&gt;AI능력시험&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;KT, 한국경제신문이 주관하는 &lt;span style=&quot;background-color: #9feec3;&quot;&gt;&lt;b&gt;민간자격증&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;AI 역량에 따라 5개 레벨로 구성되어 있음&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;nbsp; &lt;b&gt;AICE Associate 개요&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;파이썬을 다룰 수 있는 SW준/전공자 대상&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 권장대상: 현업에서 대용량 데이터를 다루거나, 데이터 기반 분석 및 기획업무를 하는 사람들&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 특정 교육과정 수료, 선행 자격증 취득 등의 요건 없음&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;응시 시간: 90분&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #9feec3;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;100% 실기평가&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;- 시험환경: Jupyter Notebook (&lt;/b&gt;현업에서 가장 많이 활용하는 인공지능 개발환경)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; - 기본적인 파이썬 문법, 데이터/인공지능 모델링 분야에 대한 이해 필요&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #9feec3;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;오픈북 시험 방식&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 구글링으로 코드 검색 및 참고 가능&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 금지행위: 듀얼모니터, 온라인노트/메모, 교재, 인쇄물, 메신저/SNS, ChatGPT 등의 생성형AI&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #9feec3;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;온라인 비대면 방식&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 인터넷 접속되는 어디서나 응시 가능&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- &lt;span style=&quot;background-color: #9feec3;&quot;&gt;웹캠&lt;/span&gt; 준비 필요 (부정행위 실시간 모니터링을 위함)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;응시비용: 80,000원 &lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(참고. 시나공 수험서를 구매했다면 뒷부분에 20% 할인쿠폰이 있으니 활용할 것!)&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;결과확인: 응시일로부터 2주 후&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;유효기간: 응시일로부터 3년&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;nbsp; &lt;b&gt;AICE Associate 구성 및 출제범위&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;문제유형: &lt;span style=&quot;background-color: #9feec3;&quot;&gt;파이썬 코드를 입력하는 주관식 중심&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- Tabular 데이터 1개가 주어지고, 문제에 따라 차례대로 코드 입력 및 실행하는 방식&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 결과해석능력 평가를 위한 단답형 문항도 일부 있음 (객관식X)&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 채점방식:&amp;nbsp;코드&amp;nbsp;일치여부,&amp;nbsp;결과&amp;nbsp;일치여부&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 안 나오는 것: 인공지능 관련 이론, 비정형 데이터(이미지, 자연어 등)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;문제 수: 총 14개&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;출제범위&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style13&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;분야&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 38.2558%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;상세 출제내용&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 14.3023%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;문항 개수&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.6745%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;배점&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 14.7674%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;합격 기준&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;데이터 분석&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 38.2558%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;bull;&amp;nbsp; 필요한 라이브러리 설치&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;bull;&amp;nbsp; Tabular 데이터 로딩 및 저장&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 데이터 구성 확인 및 상관분석&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 기초 데이터 다루기 (데이터프레임 다루기)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 14.3023%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;5~6 문항&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.6745%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;30점&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 14.7674%; text-align: center;&quot; rowspan=&quot;3&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;100점 만점 중&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;80점 이상 득점&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;전처리 &amp;amp; 시각화&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 38.2558%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 데이터 결측치 처리&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 라벨 인코딩, 원핫 인코딩&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; X, Y 데이터 분리하기&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 데이터 정규분포화 및 표준화&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 14.3023%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;4~5 문항&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.6745%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;30점&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 20%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;모델링&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 38.2558%;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 머신러닝 모델 학습&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 딥러닝 모델 학습&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 모델 성능 평가 및 시뮬레이션&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &amp;bull;&amp;nbsp; 모델 성능 개선 및 그래픽 출력&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 14.3023%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;4~5 문항&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 12.6745%; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;40점&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;출처링크: &lt;a href=&quot;https://www.aice.team/guidebook&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://www.aice.team/guidebook&lt;/a&gt;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/130</guid>
      <comments>https://sy-log.tistory.com/entry/AICE-Associate-AI%EC%9E%90%EA%B2%A9%EC%A6%9D-%EC%8B%9C%ED%97%98-%EC%B6%9C%EC%A0%9C%EB%B2%94%EC%9C%84-%EC%A0%95%EB%A6%AC#entry130comment</comments>
      <pubDate>Fri, 14 Jun 2024 17:08:04 +0900</pubDate>
    </item>
    <item>
      <title>간단하게 파이썬 버전 확인하고 업그레이드 or 다운그레이드하기 (Python version upgrade downgrade)</title>
      <link>https://sy-log.tistory.com/entry/%EA%B0%84%EB%8B%A8%ED%95%98%EA%B2%8C-%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EB%B2%84%EC%A0%84-%ED%99%95%EC%9D%B8%ED%95%98%EA%B3%A0-%EC%97%85%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C-or-%EB%8B%A4%EC%9A%B4%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C%ED%95%98%EA%B8%B0-Python-version-upgrade-downgrade</link>
      <description>&lt;h3 style=&quot;text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;아나콘다 프롬프트Anaconda Prompt에서 파이썬 버전 확인하고 바꾸기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style5&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;1️⃣ 파이썬 버전 확인하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;아나콘다 프롬프트 실행&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;입력: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;python --version&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;현재 설치된 파이썬 버전이 나옵니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;pre id=&quot;code_1718348226821&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;python --version&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1451&quot; data-origin-height=&quot;179&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bGHYNq/btsHZSeqdPD/zMEMSE1RxykeHeKwdExyAk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bGHYNq/btsHZSeqdPD/zMEMSE1RxykeHeKwdExyAk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bGHYNq/btsHZSeqdPD/zMEMSE1RxykeHeKwdExyAk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbGHYNq%2FbtsHZSeqdPD%2FzMEMSE1RxykeHeKwdExyAk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1451&quot; height=&quot;179&quot; data-origin-width=&quot;1451&quot; data-origin-height=&quot;179&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;2️⃣ 업/다운그레이드 시킬 수 있는 파이썬 버전 확인하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;입력: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;conda search python&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;현재 재설치할 수 있는 파이썬 버전이 쭉 나옵니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;pre id=&quot;code_1718348612069&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;conda search python&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1823&quot; data-origin-height=&quot;1202&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bxL60H/btsHZVWoNb3/UTDqV1HYRLkymeNi9tSUV0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bxL60H/btsHZVWoNb3/UTDqV1HYRLkymeNi9tSUV0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bxL60H/btsHZVWoNb3/UTDqV1HYRLkymeNi9tSUV0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbxL60H%2FbtsHZVWoNb3%2FUTDqV1HYRLkymeNi9tSUV0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1823&quot; height=&quot;1202&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1823&quot; data-origin-height=&quot;1202&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;3️⃣ 파이썬 버전 업그레이드 or 다운그레이드 재설치 진행하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ol style=&quot;list-style-type: decimal;&quot; data-ke-list-type=&quot;decimal&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;입력: &lt;span style=&quot;background-color: #dddddd;&quot;&gt;conda install python==버전&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;시간이 꽤 걸릴 수 있습니다. &lt;br /&gt;기다리고 있으면 파이썬 버전에 맞게 알아서 필수 패키지들까지 버전을 업/다운그레이드 시켜줍니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;done 이 나오면 완료입니다!&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;pre id=&quot;code_1718348874206&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;conda install python==버전&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1451&quot; data-origin-height=&quot;508&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/mxJd1/btsHZ5rX2jT/CswwIMOBckK8lhdhkwgnzk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/mxJd1/btsHZ5rX2jT/CswwIMOBckK8lhdhkwgnzk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/mxJd1/btsHZ5rX2jT/CswwIMOBckK8lhdhkwgnzk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmxJd1%2FbtsHZ5rX2jT%2FCswwIMOBckK8lhdhkwgnzk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1451&quot; height=&quot;508&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1451&quot; data-origin-height=&quot;508&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <category>anaconda</category>
      <category>Python</category>
      <category>아나콘다</category>
      <category>파이썬</category>
      <category>파이썬 버전 다운그레이드</category>
      <category>파이썬 버전 업그레이드</category>
      <category>파이썬 버전 확인</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/129</guid>
      <comments>https://sy-log.tistory.com/entry/%EA%B0%84%EB%8B%A8%ED%95%98%EA%B2%8C-%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EB%B2%84%EC%A0%84-%ED%99%95%EC%9D%B8%ED%95%98%EA%B3%A0-%EC%97%85%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C-or-%EB%8B%A4%EC%9A%B4%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C%ED%95%98%EA%B8%B0-Python-version-upgrade-downgrade#entry129comment</comments>
      <pubDate>Fri, 14 Jun 2024 16:10:55 +0900</pubDate>
    </item>
    <item>
      <title>국내 반도체 ETF TOP6 한번에 비교하기 - 순자산총액 기준 TOP6 (TIGER Fn반도체TOP10, KODEX 반도체 등)</title>
      <link>https://sy-log.tistory.com/entry/%EA%B5%AD%EB%82%B4-%EB%B0%98%EB%8F%84%EC%B2%B4-ETF-TOP6-%ED%95%9C%EB%B2%88%EC%97%90-%EB%B9%84%EA%B5%90%ED%95%98%EA%B8%B0-%EC%88%9C%EC%9E%90%EC%82%B0%EC%B4%9D%EC%95%A1-%EA%B8%B0%EC%A4%80-TOP6-TIGER-Fn%EB%B0%98%EB%8F%84%EC%B2%B4TOP10-KODEX-%EB%B0%98%EB%8F%84%EC%B2%B4-%EB%93%B1</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;국내 반도체 ETF TOP6 한번에 비교&lt;/b&gt;&amp;nbsp;(TOP6-24.06.13 순자산총액 기준)&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;순자산총액 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;TIGER Fn반도체TOP10&lt;/b&gt;의 순자산총액이 8,462억으로 가장 높고, 그 뒤로 &lt;b&gt;KODEX 반도체&lt;/b&gt;와 &lt;b&gt;SOL AI반도체소부장&lt;/b&gt;이 높습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;SOL AI반도체소부장&lt;/b&gt;은 이제 상장 1년남짓, &lt;b&gt;KODEX AI반도체핵심장비&lt;/b&gt;는 1년도 안되었는데 TOP6 안에 들어오는 것을 보면&lt;br /&gt;안그래도 수익률이 높은편인 반도체에&lt;b&gt; AI테마&lt;/b&gt;까지 더해져서 많은 투자자가 몰린 것 같습니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;721&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ct6vKb/btsHXtfvcTZ/R8ty1xL8XLV2arpDRc2351/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ct6vKb/btsHXtfvcTZ/R8ty1xL8XLV2arpDRc2351/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ct6vKb/btsHXtfvcTZ/R8ty1xL8XLV2arpDRc2351/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fct6vKb%2FbtsHXtfvcTZ%2FR8ty1xL8XLV2arpDRc2351%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1822&quot; height=&quot;721&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;721&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;총보수율(TER), 실제부담비용율 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;총보수율(TER)&lt;/b&gt;은 일반적인 보수에 기타비용을 더한 비용인데요, 여기에 &lt;b&gt;수수료&lt;/b&gt;까지 더해야 &lt;b&gt;투자자가 실제로 부담하는 비용&lt;/b&gt;이 &lt;br /&gt;산출됩니다.&amp;nbsp;&lt;b&gt;KBSTAR 비메모리반도체액티브&lt;/b&gt;가 약 0.59%로 가장 높고, 그 다음 높은 것이 &lt;b&gt;TIGER Fn반도체TOP10&lt;/b&gt; 이네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;KODEX AI반도체핵심장비&lt;/b&gt; 종목이 TOP6중에선 유일하게 0.4%대로, 비교적 낮은 비용을 자랑하고 있습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1824&quot; data-origin-height=&quot;721&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ciNMAs/btsHYZxqUZ5/RlNNOLpkBMxy5Vz16595Hk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ciNMAs/btsHYZxqUZ5/RlNNOLpkBMxy5Vz16595Hk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ciNMAs/btsHYZxqUZ5/RlNNOLpkBMxy5Vz16595Hk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FciNMAs%2FbtsHYZxqUZ5%2FRlNNOLpkBMxy5Vz16595Hk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1824&quot; height=&quot;721&quot; data-origin-width=&quot;1824&quot; data-origin-height=&quot;721&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;국내 반도체 ETF TOP6 수익률 한번에 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;TOP6 종목들의 최근 수익률을 비교해보겠습니다.&amp;nbsp; 역시 TOP1인 &lt;b&gt;TIGER Fn반도체TOP10&lt;/b&gt; 이 계속 높은 수익률을 보여주는데요,&lt;br /&gt;&lt;b&gt;KODEX AI반도체&lt;span style=&quot;text-align: left;&quot;&gt;핵심장비&lt;/span&gt;&lt;/b&gt; 의 수익률 상승이 심상치 않아 보입니다. 상장된지 6개월 정도됐는데 수익률 약 43%로 가장 높네요.&lt;br /&gt;KODEX AI반도체&lt;span style=&quot;text-align: left;&quot;&gt;핵심장비&lt;/span&gt; 의 1년 상승률이 기대됩니다. 이대로 수익률 TOP1을 차지할까요?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;올해만 놓고 보면 1,2위를 제외하고 나머지 4개 종목의 수익률은 20% 초반대로 비슷하네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.6511%; height: 131px;&quot; border=&quot;1&quot; width=&quot;1488&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style2&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 30px;&quot;&gt;
&lt;td style=&quot;height: 30px; text-align: center;&quot; colspan=&quot;2&quot; width=&quot;672&quot; height=&quot;121&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;ETF 종목명&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 30px; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1개월 (%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 30px; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;3개월 (%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 30px; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;6개월 (%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 30px; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;YTD (%)&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 30px; text-align: center;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1년 (%)&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 20px;&quot;&gt;
&lt;td style=&quot;height: 20px;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;TIGER Fn반도체TOP10&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;9.58&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;20.39&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;39.31&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;32.92&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;56.18&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 11px;&quot;&gt;
&lt;td style=&quot;height: 11px;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;2&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 11px;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;KODEX 반도체&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 11px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;7.99&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 11px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;14.31&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 11px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;27.51&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 11px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;22.04&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 11px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;37.81&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 20px;&quot;&gt;
&lt;td style=&quot;height: 20px;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;3&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;SOL AI반도체소부장&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;6.09&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;11.20&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;25.50&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;22.92&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 20px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;48.75&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;4&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;KBSTAR 비메모리반도체액티브&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;2.95&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;9.04&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;25.46&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;20.55&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;47.25&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 16px;&quot;&gt;
&lt;td style=&quot;height: 16px;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;5&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 16px;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;TIGER 반도체&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 16px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;7.44&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 16px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;13.52&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 16px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;27.49&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 16px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;21.96&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 16px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;37.54&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;height: 17px;&quot;&gt;
&lt;td style=&quot;height: 17px;&quot; width=&quot;65&quot; height=&quot;94&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;6&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px;&quot; width=&quot;607&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;KODEX AI반도체핵심장비&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;7.59&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;17.93&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;43.13&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;43.13&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;height: 17px; text-align: right;&quot; width=&quot;163&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;-&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1736&quot; data-origin-height=&quot;839&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/r3SV8/btsHXgtW917/yvgS6rj3gtce5OFqfOOHB0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/r3SV8/btsHXgtW917/yvgS6rj3gtce5OFqfOOHB0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/r3SV8/btsHXgtW917/yvgS6rj3gtce5OFqfOOHB0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fr3SV8%2FbtsHXgtW917%2FyvgS6rj3gtce5OFqfOOHB0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1736&quot; height=&quot;839&quot; data-origin-width=&quot;1736&quot; data-origin-height=&quot;839&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;순자산총액 TOP2 2개종목, 그리고 AI를 달고 작년에 새로 상장된 2개 종목 &amp;rarr; &lt;b&gt;4개 종목&lt;/b&gt;으로 추려서 &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;올해 수익률&lt;/b&gt;과 &lt;b&gt;최근 1년 수익률&lt;/b&gt;을 비교해봤습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1070&quot; data-origin-height=&quot;798&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/80CbS/btsHXFtupV8/rZC4XctqmQtuQT0i8KCvtk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/80CbS/btsHXFtupV8/rZC4XctqmQtuQT0i8KCvtk/img.png&quot; data-alt=&quot;올해 수익률(YTD) 비교&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/80CbS/btsHXFtupV8/rZC4XctqmQtuQT0i8KCvtk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F80CbS%2FbtsHXFtupV8%2FrZC4XctqmQtuQT0i8KCvtk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1070&quot; height=&quot;798&quot; data-origin-width=&quot;1070&quot; data-origin-height=&quot;798&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;올해 수익률(YTD) 비교&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1055&quot; data-origin-height=&quot;797&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/decBwT/btsHXPCANcb/GvtPdbBXsXUgvTQQ2BX0M0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/decBwT/btsHXPCANcb/GvtPdbBXsXUgvTQQ2BX0M0/img.png&quot; data-alt=&quot;최근 1년 수익률 비교&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/decBwT/btsHXPCANcb/GvtPdbBXsXUgvTQQ2BX0M0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdecBwT%2FbtsHXPCANcb%2FGvtPdbBXsXUgvTQQ2BX0M0%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1055&quot; height=&quot;797&quot; data-origin-width=&quot;1055&quot; data-origin-height=&quot;797&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;최근 1년 수익률 비교&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;구성종목 비교&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;KODEX 반도체, TIGER 반도체&lt;/b&gt;는 같은 KRX지수를 추종하는 만큼 구성종목과 비율이 비슷합니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;TIGER Fn반도체TOP10&lt;/b&gt;도 구성종목과 순위가 비슷하지만, 이름그대로 TOP10에 집중하는만큼 비율이 크게 잡힙니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;AI 2개종목&lt;/b&gt;은 하이닉스와 삼성전자가 없고, 한미반도체와 리노공업의 비중이 높은 점이 눈에 띄네요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;KBSTAR 비메모리반도체액티브&lt;/b&gt;는 삼성전자의 비중이 가장 높은 점이 특징이네요. 참고하시기 바랍니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;721&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/v33Dt/btsHX3naNrG/iTpOeywxU0pRJx3fi5kan1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/v33Dt/btsHX3naNrG/iTpOeywxU0pRJx3fi5kan1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/v33Dt/btsHX3naNrG/iTpOeywxU0pRJx3fi5kan1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fv33Dt%2FbtsHX3naNrG%2FiTpOeywxU0pRJx3fi5kan1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1822&quot; height=&quot;721&quot; data-origin-width=&quot;1822&quot; data-origin-height=&quot;721&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;※ 투자 판단 및 의사결정으로 인한 책임은 투자자 본인에게 있습니다. 이 글은 단순 정리글이며 투자 권유글이 아닙니다.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>위키/경제&amp;amp;투자</category>
      <category>ETF</category>
      <category>ETF비교</category>
      <category>국내ETF</category>
      <category>반도체ETF</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/128</guid>
      <comments>https://sy-log.tistory.com/entry/%EA%B5%AD%EB%82%B4-%EB%B0%98%EB%8F%84%EC%B2%B4-ETF-TOP6-%ED%95%9C%EB%B2%88%EC%97%90-%EB%B9%84%EA%B5%90%ED%95%98%EA%B8%B0-%EC%88%9C%EC%9E%90%EC%82%B0%EC%B4%9D%EC%95%A1-%EA%B8%B0%EC%A4%80-TOP6-TIGER-Fn%EB%B0%98%EB%8F%84%EC%B2%B4TOP10-KODEX-%EB%B0%98%EB%8F%84%EC%B2%B4-%EB%93%B1#entry128comment</comments>
      <pubDate>Fri, 14 Jun 2024 01:14:47 +0900</pubDate>
    </item>
    <item>
      <title>국내 ETF 진짜 총보수율 쉽게 비교하기 (feat. 금융투자협회 전자공시)</title>
      <link>https://sy-log.tistory.com/entry/%EA%B5%AD%EB%82%B4-ETF-%EC%A7%84%EC%A7%9C-%EC%B4%9D%EB%B3%B4%EC%88%98%EC%9C%A8-%EC%89%BD%EA%B2%8C-%EB%B9%84%EA%B5%90%ED%95%98%EA%B8%B0-feat-%EA%B8%88%EC%9C%B5%ED%88%AC%EC%9E%90%ED%98%91%ED%9A%8C-%EC%A0%84%EC%9E%90%EA%B3%B5%EC%8B%9C</link>
      <description>&lt;h3 style=&quot;color: #000000; text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;금융투자협회 전자공시시스템에서 국내상장 ETF &quot;진짜 총보수율&quot; 쉽게 비교하기!&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-style=&quot;style5&quot; data-ke-type=&quot;horizontalRule&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &amp;nbsp;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;ETF 보수율&lt;/b&gt;&lt;/span&gt;&lt;b&gt; 이란? &amp;mdash; ETF의 운용 및 서비스의 대가로 투자자가 지불하는 비용의 비율입니다.&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;돈을 이체할때 은행에 수수료를 지불하듯이.. ETF도 운용사 등에 서비스의 대가 즉, 보수를 지불해야 합니다.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이 보수비용을 순자산으로 나눈 비율이 &lt;span style=&quot;background-color: #f6e199;&quot;&gt;보수율&lt;/span&gt;입니다.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;무조건 투자자가 부담해야 하는 비용이기 때문에, 적을수록 투자자에게 유리하겠죠.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;ETF 보수율&lt;/b&gt;&lt;b&gt; 유심히 들여다보면, &lt;/b&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;사이트/앱마다 제각각!&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;요새 ETF에 관심을 가지고 공부하다가 충격적인 점을 발견했는데, &lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;ETF는 하나인데 보수율은 하나가 아닌 것입니다!&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;예를들어 TIGER Fn반도체 TOP10를 검색해보면,&amp;nbsp;&lt;br /&gt;&lt;b&gt;네이버와 신한에서는 0.45% 이지만 미래에셋에서 0.51% 로 0.06% 씩이나 차이가 납니다.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;그럼 투자자는 대체 어떤 숫자를 믿고 투자해야 하는걸까요?&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;2916&quot; data-origin-height=&quot;1574&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bETqni/btsHWRNFpK6/9XT8eNu6s6n3a8KTkGHOgk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bETqni/btsHWRNFpK6/9XT8eNu6s6n3a8KTkGHOgk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bETqni/btsHWRNFpK6/9XT8eNu6s6n3a8KTkGHOgk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbETqni%2FbtsHWRNFpK6%2F9XT8eNu6s6n3a8KTkGHOgk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;823&quot; height=&quot;444&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;2916&quot; data-origin-height=&quot;1574&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;  &lt;b&gt;증권사사이트에 들어가서, ETF 투자설명서를 다운받아서, 총보수&amp;middot;비용을 직접 봐야한다구요?&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아래처럼 ETF &quot;투자설명서&quot; 를 다운받아서 확인해보면 보수율뿐만 아니라 &lt;b&gt;기타비용까지 더해진 &lt;span style=&quot;background-color: #f6e199;&quot;&gt;총보수&amp;middot;비용&lt;/span&gt;&lt;/b&gt;이 나와있습니다.&lt;br /&gt;투자자가 부담해야 하는건 결국 0.51% 니까요, &lt;span style=&quot;color: #000000; text-align: left;&quot;&gt;미래에셋증권에서 제공하는 보수율이 &lt;b&gt;&quot;진짜 총보수율&quot;&lt;/b&gt; 이었네요.&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1453&quot; data-origin-height=&quot;258&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Lvly3/btsHXoc5WTv/PyR5ae2Z9qiPcLnB5lkRLk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Lvly3/btsHXoc5WTv/PyR5ae2Z9qiPcLnB5lkRLk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Lvly3/btsHXoc5WTv/PyR5ae2Z9qiPcLnB5lkRLk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FLvly3%2FbtsHXoc5WTv%2FPyR5ae2Z9qiPcLnB5lkRLk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;753&quot; height=&quot;134&quot; data-origin-width=&quot;1453&quot; data-origin-height=&quot;258&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;구글이나 네이버에 검색해보면, 이런식으로 &quot;진짜 총보수율&quot;이 잘 드러나 있지 않으니&lt;br /&gt;&lt;b&gt;투자자가 직접 ETF운용사(증권사) 사이트에 들어가서 잘 확인해보고 투자해야 한다&lt;/b&gt;고 합니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;물론 직접 공부하고 투자하는건 좋지만요.. 여러 ETF를 비교분석해서 선택하고 싶다면 &lt;b&gt;다소 비효율적인 것 같습니다.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; &lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt; 금융투자협회 전자공시시스템에서 ETF 진짜 총보수율 쉽게 비교하기!&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;증권사에서 숨겨놔도 &quot;공시시스템&quot;에는 투명하게 나와있을 수밖에 없습니다^^ &lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;여기서 검색해서 한번에 비교해보겠습니다.&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;(1) 금융투자협회 전자공시시스템 접속하기: &lt;a href=&quot;https://dis.kofia.or.kr/websquare/index.jsp?w2xPath=/wq/main/main.xml&quot; target=&quot;_blank&quot; rel=&quot;noopener&amp;nbsp;noreferrer&quot;&gt;https://dis.kofia.or.kr/websquare/index.jsp?w2xPath=/wq/main/main.xml&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1718205520836&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;금융투자협회&quot; data-og-description=&quot;&quot; data-og-host=&quot;dis.kofia.or.kr&quot; data-og-source-url=&quot;https://dis.kofia.or.kr/websquare/index.jsp?w2xPath=/wq/main/main.xml&quot; data-og-url=&quot;https://dis.kofia.or.kr/websquare/index.jsp?w2xPath=%2Fwq%2Fmain%2Fmain.xml&quot; data-og-image=&quot;&quot;&gt;&lt;a href=&quot;https://dis.kofia.or.kr/websquare/index.jsp?w2xPath=/wq/main/main.xml&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://dis.kofia.or.kr/websquare/index.jsp?w2xPath=/wq/main/main.xml&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url();&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;금융투자협회&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;dis.kofia.or.kr&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(2) &lt;span style=&quot;background-color: #f6e199;&quot;&gt;펀드공시 &amp;rarr; 펀드별 보수비용비교&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1746&quot; data-origin-height=&quot;411&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/clJQRz/btsHWxhxLGB/aGDJO0EwmxsomERtnGKZiK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/clJQRz/btsHWxhxLGB/aGDJO0EwmxsomERtnGKZiK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/clJQRz/btsHWxhxLGB/aGDJO0EwmxsomERtnGKZiK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FclJQRz%2FbtsHWxhxLGB%2FaGDJO0EwmxsomERtnGKZiK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1746&quot; height=&quot;411&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1746&quot; data-origin-height=&quot;411&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;(3) 원하는 조건으로 검색하기&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1655&quot; data-origin-height=&quot;1317&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/nN6qS/btsHV83mx5N/XmT4nRwRg00J3jjwTGCXVK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/nN6qS/btsHV83mx5N/XmT4nRwRg00J3jjwTGCXVK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/nN6qS/btsHV83mx5N/XmT4nRwRg00J3jjwTGCXVK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FnN6qS%2FbtsHV83mx5N%2FXmT4nRwRg00J3jjwTGCXVK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1655&quot; height=&quot;1317&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1655&quot; data-origin-height=&quot;1317&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: circle;&quot; data-ke-list-type=&quot;circle&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;저는 국내 반도체 관련 ETF를 비교해보기 위해, 위와 같이 검색해봤습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;진짜 &lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;총 보수율(TER) = 보수율 + 기타비용&lt;/b&gt;&lt;/span&gt; 이 바로 나오네요!&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;항목마다 &lt;b&gt;돋보기 표시를 누르면, 아래처럼 ETF 기본정보, 차트, 투자설명서를 볼 수 있습니다.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;개인적으론 먼저 공시시스템에서 주루룩 스캔하고 비교해본 다음, 관심가는 것들 하나하나 뜯어보는게 더 효율적인 것 같습니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1486&quot; data-origin-height=&quot;1241&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/k74f1/btsHWRtkFc3/jnVmG1FZLxtWnJF4tDbH7k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/k74f1/btsHWRtkFc3/jnVmG1FZLxtWnJF4tDbH7k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/k74f1/btsHWRtkFc3/jnVmG1FZLxtWnJF4tDbH7k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fk74f1%2FbtsHWRtkFc3%2FjnVmG1FZLxtWnJF4tDbH7k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1486&quot; height=&quot;1241&quot; data-origin-width=&quot;1486&quot; data-origin-height=&quot;1241&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block&quot;
     data-ad-format=&quot;autorelaxed&quot;
     data-ad-client=&quot;ca-pub-4057459746682342&quot;
     data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>위키/경제&amp;amp;투자</category>
      <category>ETF</category>
      <category>etf보수율</category>
      <category>etf보수율비교</category>
      <category>ETF투자</category>
      <category>금융투자협회</category>
      <category>총보수율</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/127</guid>
      <comments>https://sy-log.tistory.com/entry/%EA%B5%AD%EB%82%B4-ETF-%EC%A7%84%EC%A7%9C-%EC%B4%9D%EB%B3%B4%EC%88%98%EC%9C%A8-%EC%89%BD%EA%B2%8C-%EB%B9%84%EA%B5%90%ED%95%98%EA%B8%B0-feat-%EA%B8%88%EC%9C%B5%ED%88%AC%EC%9E%90%ED%98%91%ED%9A%8C-%EC%A0%84%EC%9E%90%EA%B3%B5%EC%8B%9C#entry127comment</comments>
      <pubDate>Thu, 13 Jun 2024 01:06:31 +0900</pubDate>
    </item>
    <item>
      <title>[셀레니움 크롤링 예제] 다나와 리뷰 크롤링을 위한 지속가능한 코드 만들기 (2)</title>
      <link>https://sy-log.tistory.com/entry/%EC%85%80%EB%A0%88%EB%8B%88%EC%9B%80-%ED%81%AC%EB%A1%A4%EB%A7%81-%EC%98%88%EC%A0%9C-%EB%8B%A4%EB%82%98%EC%99%80-%EB%A6%AC%EB%B7%B0-%ED%81%AC%EB%A1%A4%EB%A7%81%EC%9D%84-%EC%9C%84%ED%95%9C-%EC%A7%80%EC%86%8D%EA%B0%80%EB%8A%A5%ED%95%9C-%EC%BD%94%EB%93%9C-%EB%A7%8C%EB%93%A4%EA%B8%B0-2</link>
      <description>&lt;p style=&quot;text-align: center;&quot; data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;text-align: center;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;다나와 크롤링 예제 &amp;mdash; 공기청정기 인기 제품리뷰 수집하기&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;✅&amp;nbsp; 이전 단계가 궁금하다면,&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;table style=&quot;border-collapse: collapse; width: 99.7674%; height: 57px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style16&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 50%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 30px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%85%80%EB%A0%88%EB%8B%88%EC%9B%80-%ED%81%AC%EB%A1%A4%EB%A7%81-%EC%98%88%EC%A0%9C-%EB%8B%A4%EB%82%98%EC%99%80-%EB%A6%AC%EB%B7%B0-%ED%81%AC%EB%A1%A4%EB%A7%81%EC%9D%84-%EC%9C%84%ED%95%9C-%EC%A7%80%EC%86%8D%EA%B0%80%EB%8A%A5%ED%95%9C-%EC%BD%94%EB%93%9C-%EB%A7%8C%EB%93%A4%EA%B8%B0-1&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; (이전포스팅) 다나와 제품정보 크롤링하기! &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;0️⃣&amp;nbsp; 이전 포스팅에서 크롤링했던 제품정보들을 가지고 와서 살펴보겠습니다.&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;피클파일로 저장했던 데이터프레임을 그대로 가져와서, &lt;span style=&quot;background-color: #dddddd;&quot;&gt;dtypes&lt;/span&gt;로 데이터타입까지 잘 가져와졌는지 점검합니다.&lt;br /&gt;수치데이터가 들어간 칼럼들은 float 혹은 int로 잘 저장되어 왔네요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1663&quot; data-origin-height=&quot;1422&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b8woCn/btsHSUwrE85/F6HYKgpkzbWsYlD66N1juk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b8woCn/btsHSUwrE85/F6HYKgpkzbWsYlD66N1juk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b8woCn/btsHSUwrE85/F6HYKgpkzbWsYlD66N1juk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb8woCn%2FbtsHSUwrE85%2FF6HYKgpkzbWsYlD66N1juk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1663&quot; height=&quot;1422&quot; data-origin-width=&quot;1663&quot; data-origin-height=&quot;1422&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;1️⃣&amp;nbsp; 제품별 상세페이지로 들어간 다음, 리뷰 페이지를 넘기면서 크롤링해오려고 합니다.&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;제품별로 상세페이지 URL&lt;/b&gt;을 수집했었죠! 이제 이 URL에 순서대로 접속해서 리뷰를 크롤링해오겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;상세페이지 URL 접속 &amp;rarr; 상품리뷰로 이동 &lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;&amp;rarr; 리뷰 페이지 넘기면서 &lt;span style=&quot;text-align: left;&quot;&gt;&amp;rarr;&lt;/span&gt; 페이지 소스 가져오기&lt;/b&gt;&lt;/span&gt; 흐름으로 구성해볼게요.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;일단 맨 첫번째 제품으로 테스트를 해보겠습니다.&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;2489&quot; data-origin-height=&quot;963&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/ngx86/btsHROEbnNa/Rgd9YjGdt0NRorLVkrzbeK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/ngx86/btsHROEbnNa/Rgd9YjGdt0NRorLVkrzbeK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/ngx86/btsHROEbnNa/Rgd9YjGdt0NRorLVkrzbeK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fngx86%2FbtsHROEbnNa%2FRgd9YjGdt0NRorLVkrzbeK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;2489&quot; height=&quot;963&quot; data-origin-width=&quot;2489&quot; data-origin-height=&quot;963&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1375&quot; data-origin-height=&quot;675&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cGrc4O/btsHSFzte0q/3wtltH9KfqOWijztLaUcG1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cGrc4O/btsHSFzte0q/3wtltH9KfqOWijztLaUcG1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cGrc4O/btsHSFzte0q/3wtltH9KfqOWijztLaUcG1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcGrc4O%2FbtsHSFzte0q%2F3wtltH9KfqOWijztLaUcG1%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1375&quot; height=&quot;675&quot; data-origin-width=&quot;1375&quot; data-origin-height=&quot;675&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;리뷰 페이지 넘기면서 긁어오는 과정은 이전포스팅과 동일한 구성으로 진행하겠습니다.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;페이지&amp;nbsp;넘기고&amp;nbsp;클릭하는&amp;nbsp;동적인&amp;nbsp;부분은&amp;nbsp;Selenium이,&amp;nbsp;한&amp;nbsp;페이지에서&amp;nbsp;소스&amp;nbsp;긁어오는건&amp;nbsp;BeautifulSoup이&amp;nbsp;합니다.&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;while 반복문&lt;/span&gt; 돌리면서 다음 페이지를 클릭해줄거에요. 에러나지 않도록 한 페이지 끝날마다 &lt;span style=&quot;background-color: #dddddd;&quot;&gt;time.sleep&lt;/span&gt; 대기도 필수입니다.&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;그리고 한 페이지마다 BeautifulSoup으로 리뷰를 전부 긁어올게요. &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;긁어온 소스들은 딕셔너리에 저장해두겠습니다.&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;마찬가지로, 맨첫번째 제품 페이지에서 테스트 해보니 문제 없네요!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1717915983195&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 페이지별 소스 저장할 빈 딕셔너리 생성
soup_dict = {}

page = 1

# page에 1씩 더하면서, 전체 페이지 수와 같아지기 전까지 반복
while page &amp;lt; num_pages:

	# 페이지별 리뷰 전부 가져오기
    soup = BeautifulSoup(driver.page_source)
    reviews = soup.select('ul.rvw_list li.danawa-prodBlog-companyReview-clazz-more')
    time.sleep(1)

    # 페이지별 리뷰 딕셔너리에 저장해두기
    soup_dict[page] = reviews
    print(page, &quot;페이지 완료!&quot;)
    
    page += 1
    
    # 11,21,31..번째 페이지인 경우 [다음 페이지] 버튼 클릭
    if page%10 == 1:
        driver.find_element(By.XPATH, 
                            '//*[@id=&quot;danawa-prodBlog-companyReview-content-list&quot;]/div/div/a').click()

    # 나머지 경우는 page에 해당하는 페이지 클릭
    else:
        # 페이지 넘기는 부분 경로 통째로 가져와놓고
        page_nums = driver.find_element(By.XPATH, 
                                        '//*[@id=&quot;danawa-prodBlog-companyReview-content-list&quot;]/div/div')
        # 다음 페이지 링크를 클릭
        page_nums.find_element(By.LINK_TEXT, str(page)).click()

    # 에러나지 않도록 한페이지마다 잠시 대기
    time.sleep(2)

# 마지막 페이지 리뷰 가져오고 마무리
soup = BeautifulSoup(driver.page_source)
reviews = soup.select('ul.rvw_list li.danawa-prodBlog-companyReview-clazz-more')
soup_dict[page] = reviews
print(page, &quot;페이지 완료!&quot;)

print(&quot;&amp;lt;&amp;lt;&amp;lt; 테스트 크롤링 완료입니다! &amp;gt;&amp;gt;&amp;gt;&quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1430&quot; data-origin-height=&quot;649&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/4uzQ3/btsHRYT9wQQ/HRWpWlie7CHXqU83IbGtmk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/4uzQ3/btsHRYT9wQQ/HRWpWlie7CHXqU83IbGtmk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/4uzQ3/btsHRYT9wQQ/HRWpWlie7CHXqU83IbGtmk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F4uzQ3%2FbtsHRYT9wQQ%2FHRWpWlie7CHXqU83IbGtmk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1430&quot; height=&quot;649&quot; data-origin-width=&quot;1430&quot; data-origin-height=&quot;649&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display: block; text-align: center;&quot; data-ad-layout=&quot;in-article&quot; data-ad-format=&quot;fluid&quot; data-ad-client=&quot;ca-pub-4057459746682342&quot; data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;2️⃣&amp;nbsp; 저장해둔 페이지 소스에서 쓸모있는 정보들만 가져와서, DataFrame에 정리해주겠습니다.&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1932&quot; data-origin-height=&quot;376&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/eEdypP/btsHSZR0IDf/PCAi8zppzsNw1uHcHw4221/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/eEdypP/btsHSZR0IDf/PCAi8zppzsNw1uHcHw4221/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/eEdypP/btsHSZR0IDf/PCAi8zppzsNw1uHcHw4221/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FeEdypP%2FbtsHSZR0IDf%2FPCAi8zppzsNw1uHcHw4221%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1932&quot; height=&quot;376&quot; data-origin-width=&quot;1932&quot; data-origin-height=&quot;376&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;별점, 구매처, 작성일, &lt;span style=&quot;text-align: left;&quot;&gt;리뷰내용 &lt;/span&gt;이렇게 하나씩 가져와보겠습니다.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;작성자ID는 이미 다나와에서 마스킹해둔 상태라.. 별 소용이 없을 것 같아 패스하려구요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;위 코드에 이어서 맨첫번째 제품에서만 리뷰 크롤링을 테스트 해보겠습니다.&lt;br /&gt;저장해뒀던 딕셔너리에서 리뷰소스 하나씩 가져와서 데이터프레임을 생성했어요. 136개 리뷰 문제없이 저장됐습니다!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1717930399213&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 모델이름, 별점, 구매처, 작성일, 리뷰내용
name_list, star_list, mall_list, date_list, review_list = [], [], [], [], []

### 딕셔너리에 저장해둔 페이지 하나씩 돌리기 ###
for key in range(len(soup_dict)):
    reviews = soup_dict[key+1]
    
    # 리뷰마다 돌리면서 모델이름 등등 가져오기
    for i in range(len(reviews)):

        # 모델이름
        try:
            name_list.append(str(df_for_review_crawling['제품모델명'][0]))
        except:
            name_list.append('')

        # 별점
        try:
            star_list.append(int
            	(reviews[i].select_one('span.star_mask').text.strip().replace('점',''))/20)
        except:
            star_list.append('')

        # 구매처
        try:
            mall_list.append(str(reviews[i].select_one('span.mall').text.strip()))
        except:
            mall_list.append('')

        # 작성일
        try:
            date_list.append(reviews[i].select_one('span.date').text.strip())
        except:
            date_list.append('')

        # 리뷰내용
        try:
            review_list.append(str(reviews[i].select_one('div.atc').text.strip()))
        except:
            review_list.append('')
        

### 크롤링 결과 저장 ###
# 데이터프레임 생성
df_result = pd.DataFrame({
    '제품모델명' : name_list, '구매처' : mall_list,
    '작성일' : date_list, '별점' : star_list, '리뷰' : review_list
}); df_result&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1664&quot; data-origin-height=&quot;923&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b31F1F/btsHTTjifLC/n3cy9RK5qk20ivDY2RkwYK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b31F1F/btsHTTjifLC/n3cy9RK5qk20ivDY2RkwYK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b31F1F/btsHTTjifLC/n3cy9RK5qk20ivDY2RkwYK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb31F1F%2FbtsHTTjifLC%2Fn3cy9RK5qk20ivDY2RkwYK%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1664&quot; height=&quot;923&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1664&quot; data-origin-height=&quot;923&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display: block; text-align: center;&quot; data-ad-layout=&quot;in-article&quot; data-ad-format=&quot;fluid&quot; data-ad-client=&quot;ca-pub-4057459746682342&quot; data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h3 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size23&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣&amp;nbsp; 최종함수를 만들어서, 공기청정기 인기제품 10개만 테스트로 크롤링해볼게요!&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;이전포스팅에서 수집했던 LG전자, 삼성전자, 위닉스의 공기청정기 제품들 중 일부를 선정해서 리뷰크롤링 테스트를 해봅니다.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;다나와에서 검색되는 인기3사의 제품은 총 375개였는데요, 리뷰가 너무 적은 제품은 제외할게요.&lt;/b&gt; &lt;br /&gt;리뷰가 10개도 안쌓인 제품들은 제외하고, 리뷰 10개 이상인 제품으로 걸러보니 총 239개입니다.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;이걸 전부 크롤링하면 너무 오래 걸리겠어요..&lt;br /&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;일부만 테스트해서 크롤링이 잘되는지 보고싶으니 이중에서 상위 10개 제품만 뽑아올게요.&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718020038334&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;# 필요한 패키지 가져오기
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

from bs4 import BeautifulSoup
import time
from datetime import datetime
import pandas as pd
import math
import pickle
from tqdm import tqdm&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1666&quot; data-origin-height=&quot;1355&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bu38Ae/btsHTIww8dc/iH4vuL5QiYgKcTvWSKFW3k/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bu38Ae/btsHTIww8dc/iH4vuL5QiYgKcTvWSKFW3k/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bu38Ae/btsHTIww8dc/iH4vuL5QiYgKcTvWSKFW3k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbu38Ae%2FbtsHTIww8dc%2FiH4vuL5QiYgKcTvWSKFW3k%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1666&quot; height=&quot;1355&quot; data-origin-width=&quot;1666&quot; data-origin-height=&quot;1355&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣-(1). [함수1] 크롬드라이버 실행부터 페이지 넘기면서 크롤링까지&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이제 위에서 작성했던 코드들을 함수 2개로 묶겠습니다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;crawling_danawa_reviews_get_sources&lt;/span&gt;: 제품 상세페이지에 접속해서, 리뷰페이지를 넘기면서 긁어오는 함수입니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 입력값은 이전포스팅에서 크롤링했던 제품정보 데이터프레임입니다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 출력값은 크롤링 페이지 소스가 전부 저장된 딕셔너리 입니다. 이렇게 수집된 데이터는 함수2에서 정리될거에요.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718020300463&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def crawling_danawa_reviews_get_sources(df_for_review_crawling): 
    # 함수 입력값: 제품정보 데이터프레임
    
    # webdirver 설정 및 실행
    my_options = webdriver.ChromeOptions()
    my_options.add_argument('headless')
    my_options.add_argument('--window-size=1920,1080')
    my_options.add_argument(&quot;disable-gpu&quot;)
    driver = webdriver.Chrome(options=my_options)
    driver.implicitly_wait(1)

    # 크롤링한 페이지소스 저장할 빈 딕셔너리 생성
    result_dict = {}

    ### 제품별로 돌아가면서 상세페이지 접속 ###
    for u in range(len(df_for_review_crawling)):
        driver.get(df_for_review_crawling['링크URL'][u])
        print(u+1, &quot;.&quot;, df_for_review_crawling['제품모델명'][u], end=' ')
        time.sleep(3)

        # 제품별로 저장할 빈 딕셔너리 생성
        soup_dict = {}

        # 쇼핑몰 상품리뷰 개수 가져오기
        soup = BeautifulSoup(driver.page_source)
        num_reviews = soup.select_one('div.point_num span strong').text.strip().replace(',','')
        print('-', num_reviews, '개')

        # 리뷰 총 몇페이지인지 계산
        num_pages = math.ceil(int(num_reviews) / 10)
        
        ### 리뷰페이지 넘기면서 페이지 소스 크롤링 및 저장 ###
        # page에 1씩 더하면서, 전체 페이지 수와 같아지기 전까지 반복
        page = 1
        while page &amp;lt; num_pages:
        
            # 페이지별 리뷰 전부 가져오기
            soup = BeautifulSoup(driver.page_source)
            reviews = soup.select('ul.rvw_list li.danawa-prodBlog-companyReview-clazz-more')
            
            # 페이지별 리뷰 딕셔너리에 저장해두기
            soup_dict[page] = reviews
            
            page += 1

            # 페이지 넘기는 부분 경로 통째로 가져와놓고
            page_nums = driver.find_element(
                By.XPATH, '//*[@id=&quot;danawa-prodBlog-companyReview-content-list&quot;]/div/div')
            
            # 11,21,31..번째 페이지인 경우 [다음 페이지] 버튼 클릭
            if page%10 == 1:
                page_nums.find_element(By.CLASS_NAME, 'point_arw_r').click()
        
            # 나머지 경우는 page에 해당하는 페이지 클릭
            else:
                page_nums.find_element(By.LINK_TEXT, str(page)).click()
        
            # 에러나지 않도록 한페이지마다 잠시 대기
            print('.', end=' ')
            time.sleep(2)
        
        # 마지막 페이지 리뷰 가져오고 마무리
        soup = BeautifulSoup(driver.page_source)
        reviews = soup.select('ul.rvw_list li.danawa-prodBlog-companyReview-clazz-more')
        soup_dict[page] = reviews
        print(&quot;완료!&quot;)
        
        result_dict[u+1] = soup_dict

    # 함수 출력값: 제품별 리뷰페이지 소스 저장한 딕셔너리
    return result_dict&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1669&quot; data-origin-height=&quot;705&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cU7Nyl/btsHT9HqEKM/pgCvoa86SvfohzXzq5rP60/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cU7Nyl/btsHT9HqEKM/pgCvoa86SvfohzXzq5rP60/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cU7Nyl/btsHT9HqEKM/pgCvoa86SvfohzXzq5rP60/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcU7Nyl%2FbtsHT9HqEKM%2FpgCvoa86SvfohzXzq5rP60%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1669&quot; height=&quot;705&quot; data-origin-width=&quot;1669&quot; data-origin-height=&quot;705&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: left;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;3️⃣-(2).&amp;nbsp;[함수2] 수집된&amp;nbsp;정보를&amp;nbsp;거르고&amp;nbsp;필터링해서&amp;nbsp;분석&amp;nbsp;가능한&amp;nbsp;데이터프레임으로!&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;background-color: #dddddd;&quot;&gt;crawling_danawa_reviews_result&lt;/span&gt;: 긁어온 데이터를 돌리면서 데이터프레임으로 정리하는 함수입니다.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 입력값은 함수1에서 크롤링 페이지 소스를 저장했던 딕셔너리, 제품정보 데이터프레임, 그리고 저장할 엑셀파일의 이름입니다.&lt;br /&gt;&amp;nbsp; 제품정보 데이터프레임은 제품명을 가져와서 그대로 붙이기 위해 필요해요.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;- 출력값은 크롤링 결과가 정리된 데이터프레임, 그리고 저장된 엑셀파일입니다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1718021092804&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def crawling_danawa_reviews_result(result_dict, df_for_review_crawling, excel_title): 
    # 함수 입력값: 리뷰소스 저장된 딕셔너리, 제품정보 데이터프레임, 결과 저장할 엑셀파일명
    
    # 제품명 풀네임, 제조사, 모델명
    name_list, brand_list, model_list = [], [], []
    # 별점, 구매처, 작성일, 리뷰내용
    star_list, mall_list, date_list, review_list = [], [], [], []
    
    # 제품 하나씩 돌리기
    for key_p in tqdm(range(len(result_dict))):
        soup_dict = result_dict[key_p+1]

        # 제품명 풀네임, 제조사, 모델명 가져오기
        name = df_for_review_crawling['제품모델명'][key_p]
        brand = name.split()[0]
        model = name.split()[-1]

        # 저장해둔 리뷰페이지 하나씩 돌리기
        for key_r in range(len(soup_dict)):
            reviews = soup_dict[key_r+1]
        
            # 리뷰마다 돌리면서 내용 가져오기
            for i in range(len(reviews)):
        
                # 가져와둔 제품명 풀네임, 제조사, 모델명
                name_list.append(str(name))
                brand_list.append(str(brand))
                model_list.append(str(model))
                
                # 별점
                try:
                    star_list.append(int(
                        reviews[i].select_one('span.star_mask').text.strip().replace('점',''))/20)
                except:
                    star_list.append('')
        
                # 구매처
                try:
                    mall_list.append(str(reviews[i].select_one('span.mall').text.strip()))
                except:
                    mall_list.append('')
        
                # 작성일
                try:
                    date_list.append(reviews[i].select_one('span.date').text.strip())
                except:
                    date_list.append('')
        
                # 리뷰내용
                try:
                    review_list.append(str(reviews[i].select_one('div.atc').text.strip()))
                except:
                    review_list.append('')
            
    
    ### 크롤링 결과 저장 ###
    # 데이터프레임 생성
    df_result = pd.DataFrame({
        '제조사' : brand_list, '모델명' : model_list, '제품명' : name_list, 
        '구매처' : mall_list, '작성일' : date_list, '별점' : star_list, '리뷰' : review_list
    })

    # 데이터프레임을 엑셀파일로 저장
    with pd.ExcelWriter(excel_title) as writer:
        df_result.to_excel(writer)

    return df_result&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1663&quot; data-origin-height=&quot;1152&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/SBMoU/btsHS0LqdX8/jZ7C4hyGFCptztwpS4exWk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/SBMoU/btsHS0LqdX8/jZ7C4hyGFCptztwpS4exWk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/SBMoU/btsHS0LqdX8/jZ7C4hyGFCptztwpS4exWk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FSBMoU%2FbtsHS0LqdX8%2FjZ7C4hyGFCptztwpS4exWk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;1663&quot; height=&quot;1152&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1663&quot; data-origin-height=&quot;1152&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;제품 10개 리뷰크롤링 테스트도 성공적으로 마쳤습니다! 10개만 선정했는데도 6천개에 가까운 리뷰가 수집됐네요.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;본격적으로 모든 제품의 리뷰를 수집하려면 시간이 좀 걸릴 것 같아요.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;다음에는 수집한 리뷰들을 khaiii 형태소분석기로 쪼개서 워드클라우드라도 만들어볼까 합니다!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display: block;&quot; data-ad-format=&quot;autorelaxed&quot; data-ad-client=&quot;ca-pub-4057459746682342&quot; data-ad-slot=&quot;1928290538&quot;&gt;&lt;/ins&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>직접 해보기/Python</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/126</guid>
      <comments>https://sy-log.tistory.com/entry/%EC%85%80%EB%A0%88%EB%8B%88%EC%9B%80-%ED%81%AC%EB%A1%A4%EB%A7%81-%EC%98%88%EC%A0%9C-%EB%8B%A4%EB%82%98%EC%99%80-%EB%A6%AC%EB%B7%B0-%ED%81%AC%EB%A1%A4%EB%A7%81%EC%9D%84-%EC%9C%84%ED%95%9C-%EC%A7%80%EC%86%8D%EA%B0%80%EB%8A%A5%ED%95%9C-%EC%BD%94%EB%93%9C-%EB%A7%8C%EB%93%A4%EA%B8%B0-2#entry126comment</comments>
      <pubDate>Mon, 10 Jun 2024 22:45:42 +0900</pubDate>
    </item>
    <item>
      <title>[오픽 1트 IH 후기, 스크립트 모음] 이공계 스피킹공부 처음인 인간이 2주독학해서 IH받은 후기</title>
      <link>https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-1%ED%8A%B8-IH-%ED%9B%84%EA%B8%B0-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C-%EC%9D%B4%EA%B3%B5%EA%B3%84-%EC%8A%A4%ED%94%BC%ED%82%B9%EA%B3%B5%EB%B6%80-%EC%B2%98%EC%9D%8C%EC%9D%B8-%EC%9D%B8%EA%B0%84%EC%9D%B4-2%EC%A3%BC%EB%8F%85%ED%95%99%ED%95%B4%EC%84%9C-IH%EB%B0%9B%EC%9D%80-%ED%9B%84%EA%B8%B0</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;이렇게 어그로 끄는 제목으로 후기를 쓸 수 있게 될줄이야 아직도 감회가 새롭다!!&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;시험일은 24. 06. 02 일요일, 난이도 5-5 로 응시했다. 오늘 성적확인한 결과 IH 성공!&lt;/span&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1078&quot; data-origin-height=&quot;1078&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/YYBW3/btsHRLAcChv/FzVkKB1q3WoKA4QKw75tfk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/YYBW3/btsHRLAcChv/FzVkKB1q3WoKA4QKw75tfk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/YYBW3/btsHRLAcChv/FzVkKB1q3WoKA4QKw75tfk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FYYBW3%2FbtsHRLAcChv%2FFzVkKB1q3WoKA4QKw75tfk%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;576&quot; height=&quot;576&quot; data-filename=&quot;blob&quot; data-origin-width=&quot;1078&quot; data-origin-height=&quot;1078&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 data-ke-size=&quot;size20&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅&amp;nbsp; 시험 준비하기 전 본인 영어 프로필 간단요약&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;공대 졸업&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;약 5년 전 토익 865점&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;영어스피킹 학원, 공부 경험 X&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;유학, 어학연수, 워홀 경험 X&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;암튼 영어 듣고 읽는건 가능해도 말하는 건 어려운 수준&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;이 상태로 학원 안다니고 그냥 독학했음, 목표는 많이 안바라고 IM2 이상&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅&amp;nbsp; 오픽 시험 준비한 이유&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;무엇보다.. 삼성 계열사를 노린다면 오픽 IM 이상이 필수다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;취준할 땐 어쩌다보니 영어시험 보기도 전에 최합이 되어서 여태 영어점수가 없었다.&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;그러나 이직과 승진을 위해 스피킹 성적이 필수인 시대.. 피할 수 없다..&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;토익스피킹은 외워야 한다는 이야기가 많던데 나는 단순암기에 정말 재능이 없다.&lt;br /&gt;그리고 비즈니스 스피킹, 포멀한 스피킹 쪽이라길래 정말 자신이 없었다..&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;오픽은 사전설문으로 어느정도 내가 자신있는 문항으로 제한시킬 수 있고, 포멀하지 않은 실전스피킹 시험이다.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;외워서 다다다 말하는 건 오히려 감점요소고, 실제 대화하는 것처럼 엄~~유노~~ 이러는게 오히려 나은 시험이라는 것이다!&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;✔️ &lt;b&gt;&lt;span style=&quot;color: #009a87;&quot;&gt;오픽 시험관련 쓸모있는 정보를 모아둔 게시글들이 있으니 참고!&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 100%; height: 41px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style16&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 41px;&quot;&gt;
&lt;td style=&quot;width: 29.4767%; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 30px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD%EC%9D%B4-%EC%B2%98%EC%9D%8C%EC%9D%B4%EB%9D%BC%EB%A9%B4-%EC%98%A4%ED%94%BD-%EC%8B%9C%ED%97%98%EA%B5%AC%EC%84%B1%EA%B3%BC-%EB%82%9C%EC%9D%B4%EB%8F%84-%EC%B6%94%EC%B2%9C-AL-IH-IM3-IM2-IM1&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 오픽 특징 알아보기! &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 32.0349%; height: 41px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 30px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%82%AC%EC%A0%84%EC%84%A4%EB%AC%B8-Background-Survey-%EC%9D%B4%EB%A0%87%EA%B2%8C-%ED%95%B4%EC%95%BC-%EC%8B%9C%ED%97%98%EC%9D%B4-%EC%89%AC%EC%9B%8C%EC%A0%B8%EC%9A%94&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 사전 설문 요령 참고하기! &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 38.4884%; height: 41px; text-align: center;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 30px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%ED%95%84%EB%9F%AC-%EB%AA%A8%EC%9D%8C-Filler-words-%EB%AA%A8%EC%9D%8C-%EC%98%A4%ED%94%BD-%EB%8C%80%EB%8B%B5-%EC%96%B4%EB%A0%A4%EC%9A%B8%EB%95%8C-%EC%9C%A0%EC%9A%A9%ED%95%9C-%ED%91%9C%ED%98%84&quot;&gt; 필러 등 유용한 표현들 참고하기! &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅&amp;nbsp; 오픽 시험 준비 과정&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;u&gt;&lt;b&gt;1일차~7일차 약 일주일간: 오픽강의 틀어놓고 정말 듣기만 하기&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;영어스피킹 공부라니.. 처음이라 너무 막막해서 일주일 정도는 그냥 강의를 틀어놓고 빈지워칭(binge-watching)만 했다.&lt;br /&gt;나는 개인취미 등을 위해 클래스101을 연간구독해둔 상태라서, 구독비용 뽕뽑을겸 오픽 강의도 그냥 여기 있는거 들었다.&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&lt;span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&lt;span&gt; 난 겸사겸사 클래스101을 들은거고, 유튜브에 좋은 오픽전문계정들이 많다. &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;오픽노잼 IM, IH 한번씩 보면 충분할 듯. 사실 나는 이분꺼 보면 화면으로 기빨리는 느낌이라 잘 안보긴 했다..&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️ 온라인 오픽강의 장점: 강사님이 설명해주는 오픽 시험의 특징, 흐름, 요령을 내방에 앉아서 받아먹을 수 있음&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;온라인 오픽강의 단점: 학원처럼 끌어주고 숙제 내주고 하지 않기 때문에 나혼자 그냥 시간만 흘려보낼 수 있음&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;u&gt;&lt;b&gt;7일차~11일차: 오픽강의, 해커스유튜브 강의 들으면서 내 스크립트 짜보기&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;일주일쯤 되니 오픽이 무슨 시험인진 확실히 알겠는데, 이거 내가 공부하는게 맞나싶고 슬슬 불안해진다.&amp;nbsp;&lt;br /&gt;&lt;b&gt;여가및취미, 돌발주제, 롤플레이 크게 3가지로 나눠서 차례대로 스크립트를 짜기 시작했다.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;✔️ 강의에서 주는 스크립트 + 내 개인경험과 지식 + 파파고 번역을 잘 비벼서 주요문항별 스크립트를 작성해보았다.&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;span&gt; 논문번역할 때는 구글번역기를 애용했지만, 스피킹 공부할 때는 파파고가 더 좋은 것 같다.&lt;br /&gt;✔️ 스크립트에 아예 Filler words를 포함해서 작성하면서, 입에서 자연스럽게 나오는지 웅얼거려보곤 했다.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;span style=&quot;color: #009a87;&quot;&gt;&lt;b&gt; 주요문항별 스크립트들을 모아 게시글을 올려두었으니 참고!&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table style=&quot;border-collapse: collapse; width: 68.6047%; height: 863px;&quot; border=&quot;1&quot; data-ke-align=&quot;alignLeft&quot; data-ke-style=&quot;style10&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 40.1953%; text-align: right;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;문항 유형&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;스크립트 모음&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 40.1953%; text-align: right;&quot; rowspan=&quot;4&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;사전설문 내용에 따라 나오는 &lt;br /&gt;&lt;span style=&quot;color: #009a87;&quot;&gt;개인맞춤 문항들&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EC%82%AC%EB%8A%94%EA%B3%B3-%EC%A7%91-%EC%A3%BC%EA%B1%B0%EC%A7%80-House-Neighborhood&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 사는곳, 집, 주거지 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EC%97%AC%EA%B0%80-%EB%B0%8F-%EC%B7%A8%EB%AF%B8-%EC%9D%8C%EC%95%85-%EC%98%81%ED%99%94-%EA%B3%B5%EC%97%B0-%EC%BD%98%EC%84%9C%ED%8A%B8&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 음악, 영화, 공연, 콘서트 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C3-%EC%97%AC%EA%B0%80-%EB%B0%8F-%EC%B7%A8%EB%AF%B8-%EA%B3%B5%EC%9B%90-%ED%95%B4%EB%B3%80-%EC%A1%B0%EA%B9%85-%EC%87%BC%ED%95%91&quot;&gt; 공연, 해변, 조깅, 쇼핑 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C4-%EC%97%AC%EA%B0%80-%EB%B0%8F-%EC%B7%A8%EB%AF%B8-%EC%A7%91%EC%97%90%EC%84%9C-%ED%9C%B4%EA%B0%80%EB%B3%B4%EB%82%B4%EA%B8%B0-%EA%B5%AD%EB%82%B4%EC%97%AC%ED%96%89&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 집에서휴가, 국내여행 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 40.1953%; text-align: right;&quot; rowspan=&quot;7&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;사전설문과 관계없이 나오는 &lt;br /&gt;&lt;span style=&quot;color: #009a87;&quot;&gt;돌발주제 문항들&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C5-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%EA%B0%80%EC%A1%B1-%EC%B9%9C%EA%B5%AC-%ED%9C%B4%EC%9D%BC-%EB%AA%85%EC%A0%88-%EA%B8%B0%EB%85%90&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 가족, 친구, 휴일, 명절 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C6-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%EB%8C%80%EC%A4%91%EA%B5%90%ED%86%B5-%EC%9D%80%ED%96%89&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 대중교통, 은행 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C7-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%ED%8C%A8%EC%85%98-%EC%9E%AC%ED%99%9C%EC%9A%A9&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 패션, 재활용 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C8-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%EA%B8%B0%EC%88%A0-%EC%9D%B8%ED%84%B0%EB%84%B7&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 기술, 인터넷 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C9-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%EA%B1%B4%EA%B0%95&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 건강 관련 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C10-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%EB%82%A0%EC%94%A8-%EA%B3%84%EC%A0%88&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 날씨, 계절 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C11-%EB%8F%8C%EB%B0%9C%EC%A3%BC%EC%A0%9C-%EC%82%B0%EC%97%85&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 산업 관련 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 40.1953%; text-align: right;&quot; rowspan=&quot;2&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;친구와 약속, 식당 예약 등등 &lt;br /&gt;&lt;span style=&quot;color: #009a87;&quot;&gt;롤플레이 문항들&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EB%A1%A4%ED%94%8C%EB%A0%88%EC%9D%B4-%EB%A7%8C%EB%8A%A5-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EC%98%88%EC%95%BD%ED%95%98%EA%B8%B0-%EB%AC%B8%EC%A0%9C%ED%95%B4%EA%B2%B0-%EC%98%88%EC%8B%9C-%EB%AA%A8%EC%9D%8C&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 롤플레이 만능 스크립트 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 47.3704%;&quot;&gt;&lt;span style=&quot;color: #000000; font-family: 'Noto Sans Demilight', 'Noto Sans KR';&quot;&gt;&lt;a style=&quot;background-color: #9feec3; color: #000000; border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: bold; text-decoration: underline double #ffffff;&quot; href=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EB%A1%A4%ED%94%8C%EB%A0%88%EC%9D%B4-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C-%ED%8C%8C%ED%8B%B0%EA%B3%B5%EC%97%B0%EC%BD%98%EC%84%9C%ED%8A%B8%EC%8B%9D%EB%8B%B9%EB%A0%88%EC%8A%A4%ED%86%A0%EB%9E%91%EC%97%AC%ED%96%89%EB%A0%8C%ED%84%B0%EC%B9%B4&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; 롤플레이 파티, 식당 등 예시모음 &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&lt;span&gt;&lt;u&gt;&lt;b&gt;12일차~시험일: 해커스유튜브 무료강의 보면서 스크립트 수정하기, 계속 중얼중얼 말해보기&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;유튜브에 오픽 한두번 검색했더니 무서운 알고리즘이 추천해주는 것이다.. 해커스 영상들을..&lt;br /&gt;전통있는 종로해커스니까 도움되지 않을까 해서 여러가지 봤는데, 임지혜 선생님이 참 잘 가르쳐 주시는 것 같다..&lt;br /&gt;당연히 광고아님 아무튼 선생님 최근 영상들을 보면서, 좋은 표현들을 많이 배웠고 스크립트에 녹여낼 수 있었다!&lt;br /&gt;&lt;br /&gt;✔️ 유튜브 영상 보면서 스크립트 수정하기, 수정하면서 스크립트를 계속 읽어보게 됨 (일부러 외우지 않아도 반쯤 외워짐)&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;span&gt; 시험전 마지막 이틀은 스크립트 입으로 읽어보고, 순서 다르게 말해보기도 하고, 눈감고 말해보기도 하고 &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;암튼 실제로 사람한테 말한다고 상상하면서 말하기 반복!&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;/span&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;&lt;span&gt; 당연히 내가 짜둔 스크립트가 실제 시험에 그대로 나오리라 보장할 수 없다. &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;그러나 이걸 작성하고 말하는 것 자체가 &quot;스피킹&quot; 연습인 것 같다! 실제로 이과정에서 &quot;나&quot;의 영어스피킹 실력이 조금 늘었다!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;&gt;&lt;/script&gt;
&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display: block; text-align: center;&quot; data-ad-layout=&quot;in-article&quot; data-ad-format=&quot;fluid&quot; data-ad-client=&quot;ca-pub-4057459746682342&quot; data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;&lt;/p&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅&amp;nbsp; &lt;b&gt;오픽 시험 당일&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-ke-mobileStyle=&quot;widthOrigin&quot; data-origin-width=&quot;1496&quot; data-origin-height=&quot;1496&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/Nd53u/btsHQ2vOXol/orukraFVcESGNmj26nuR9K/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/Nd53u/btsHQ2vOXol/orukraFVcESGNmj26nuR9K/img.png&quot; data-alt=&quot;강서 CBT센터에서 시험봤던 자리&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/Nd53u/btsHQ2vOXol/orukraFVcESGNmj26nuR9K/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FNd53u%2FbtsHQ2vOXol%2ForukraFVcESGNmj26nuR9K%2Fimg.png&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot; loading=&quot;lazy&quot; width=&quot;476&quot; height=&quot;476&quot; data-origin-width=&quot;1496&quot; data-origin-height=&quot;1496&quot;/&gt;&lt;/span&gt;&lt;figcaption&gt;강서 CBT센터에서 시험봤던 자리&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;시험장: 강서 CBT 센터 (추천)&lt;br /&gt;&lt;/b&gt;다른 후기들을 찾아보면 강서만한 시험장이 없다고 극찬들을 하신다. 가보면 깨끗하고 깔끔해서 일단 마음이 놓이고,&lt;br /&gt;사방이 유리로 막힌 닭장같은 곳에 한명씩 들어가서 시험을 진행한다. 다른 사람들 말 거의 안들리고 신경도 안쓰임!&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;시험 난이도: 5-5&lt;br /&gt;&lt;/b&gt;IM만 나와도 되니까 4를 할까 좀더 욕심내서 5를 할까.. 끝까지 엄청 고민했었다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;난이도 5 이상부터는 마지막 2문제에서 사회이슈같은 어려운 문항이 나온다고 알고 있기 때문에..그런건 자신이 없기 때문에..&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;근데 시험보기 전 OT때 난이도별로 답변예시를 들을 수 있게 재생버튼이 나오는데, 난이도 5에서 되게 느릿느릿 말하는 것이다!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;아하 pause 많더라도 할말하면 되겠구나 갑자기 용기가 솟구쳐서 난이도 5를 선택했다. 중간에도 변경없이 진행했다.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&lt;b&gt;시험 문제&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✔️ 맨처음..&amp;nbsp;최근에 무슨 약속을 했냐, 기억에 남는 약속은 뭐냐 하면서 약속콤보가 나왔다. 뭔..신유형인가? 당황스럽긴 했다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 좀 헛소리가 섞이긴 했지만.. 건강 관련 스크립트를 기억해내서 &quot;의사와의 약속&quot; 으로 이야기를 만들어서 버벅버벅 말했다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; ✔️ 개인맞춤 문항으로는 음악감상, 콘서트 관련 질문이었다. 다행히 스크립트 준비한대로의 내용이라 어느정도 말할 수 있었다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; ✔️ 운이 좋은지 롤플레이도 공연 티켓 예약 &amp;rarr; 아파서 공연 못간다고 친구한테 다른 제안 콤보가 나와서 스크립트대로 연기했다!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; ✔️ 걱정했던 마지막 2문제는 제대로 기억도 안난다. 한문제는 더듬더듬 말하고, 마지막 문제는 미안하다 말하고 패스했다.&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000; text-align: left;&quot;&gt;✔️&lt;/span&gt;&lt;span style=&quot;color: #009a87;&quot;&gt;&lt;b&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;문제 패스하는 표현 참고! &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;a href=&quot;https://buly.kr/1sFZXR&quot;&gt;https://buly.kr/1sFZXR&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt; ✔️ 다 끝내니 약 27분 정도. 너무 빨리 끝냈나 싶었다.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;figure id=&quot;og_1717766813339&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;article&quot; data-og-title=&quot;오픽 문제 스킵, 패스 표현 모음 - IH까지는 2~3문제 패스해도 괜찮다!&quot; data-og-description=&quot;✔️&amp;nbsp; 오픽은 모르는 문제 모른다고 말하고 넘긴다고 엄청 감점되지 않는다! ✔️&amp;nbsp; IH까지가 목표라면 15문제 중에 2~3개 패스해도 문제없다! ✔️&amp;nbsp; 특히 콤보문제라면 앞에서 이미 말한 경우 미&quot; data-og-host=&quot;sy-log.tistory.com&quot; data-og-source-url=&quot;https://buly.kr/1sFZXR&quot; data-og-url=&quot;https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-%EB%AC%B8%EC%A0%9C-%EC%8A%A4%ED%82%B5-%ED%8C%A8%EC%8A%A4-%ED%91%9C%ED%98%84-%EB%AA%A8%EC%9D%8C-IH%EA%B9%8C%EC%A7%80%EB%8A%94-23%EB%AC%B8%EC%A0%9C-%ED%8C%A8%EC%8A%A4%ED%95%B4%EB%8F%84-%EA%B4%9C%EC%B0%AE%EB%8B%A4&quot; data-og-image=&quot;https://scrap.kakaocdn.net/dn/Wa8yd/hyWg2N4Bov/w1JHSr2NIOcMqN9nIYiZa0/img.png?width=800&amp;amp;height=715&amp;amp;face=0_0_800_715,https://scrap.kakaocdn.net/dn/4NI2u/hyWg0W17hY/VRKcaxrZvDBKg6A7BE9K6k/img.png?width=800&amp;amp;height=715&amp;amp;face=0_0_800_715&quot;&gt;&lt;a href=&quot;https://buly.kr/1sFZXR&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://buly.kr/1sFZXR&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url('https://scrap.kakaocdn.net/dn/Wa8yd/hyWg2N4Bov/w1JHSr2NIOcMqN9nIYiZa0/img.png?width=800&amp;amp;height=715&amp;amp;face=0_0_800_715,https://scrap.kakaocdn.net/dn/4NI2u/hyWg0W17hY/VRKcaxrZvDBKg6A7BE9K6k/img.png?width=800&amp;amp;height=715&amp;amp;face=0_0_800_715');&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;오픽 문제 스킵, 패스 표현 모음 - IH까지는 2~3문제 패스해도 괜찮다!&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;✔️&amp;nbsp; 오픽은 모르는 문제 모른다고 말하고 넘긴다고 엄청 감점되지 않는다! ✔️&amp;nbsp; IH까지가 목표라면 15문제 중에 2~3개 패스해도 문제없다! ✔️&amp;nbsp; 특히 콤보문제라면 앞에서 이미 말한 경우 미&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;sy-log.tistory.com&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;script src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4057459746682342&quot;&gt;&lt;/script&gt;
&lt;p&gt;&lt;ins class=&quot;adsbygoogle&quot; style=&quot;display: block; text-align: center;&quot; data-ad-layout=&quot;in-article&quot; data-ad-format=&quot;fluid&quot; data-ad-client=&quot;ca-pub-4057459746682342&quot; data-ad-slot=&quot;2012885163&quot;&gt;&lt;/ins&gt;&lt;/p&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style6&quot; /&gt;
&lt;h4 style=&quot;color: #000000; text-align: start;&quot; data-ke-size=&quot;size20&quot;&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;✅&amp;nbsp; &lt;b&gt;나름의 소감&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;오픽 준비하는 과정에서 완전히 죽어있던 언어, 영어감각이 조금 살아난 것 같다.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;언어를 하나씩 알게 될 때마다, 내 세상이 넓어진다는 것을.. 머리로는 알고 있었지만 실천하기는 너무너무 어려웠다.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;8만원이나 하는 시험이 돈아까워서 준비하는 과정에서 어느정도 실천을 할 수 있어서 뿌듯하다!&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;오픽을 선택한 이유이기도 하지만, 오픽은 실전토킹에 도움이 되고, 임기응변이 가능하고, 무엇보다 좀.. 융통성 있는 시험같다.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;2문제 정도 주제벗어난 헛소리했고, 마지막 1문제는 패스했고, 짧게 마쳐버렸는데 IH가 나온걸 보면 꽤 너그러운 시험이다..&lt;br /&gt;많은 강사님들과 유튜브 영상에서 말하듯, 다양한 표현과 형용사, 시제 맞게 사용하기, 자연스러운 말하기가 중요한 듯.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: 'Noto Sans Demilight', 'Noto Sans KR'; color: #000000;&quot;&gt;참고. &lt;b&gt;지역마다 청년대상으로 오픽 포함 시험비용 지원해주는 사업&lt;/b&gt;을 하는 지자체가 있다. 찾아보고 무조건 지원받아내기!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>자격증/OPIc (오픽)</category>
      <category>OPIc</category>
      <category>오픽</category>
      <category>오픽IH후기</category>
      <category>오픽독학후기</category>
      <category>오픽후기</category>
      <author>서윤L</author>
      <guid isPermaLink="true">https://sy-log.tistory.com/125</guid>
      <comments>https://sy-log.tistory.com/entry/%EC%98%A4%ED%94%BD-1%ED%8A%B8-IH-%ED%9B%84%EA%B8%B0-%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%AA%A8%EC%9D%8C-%EC%9D%B4%EA%B3%B5%EA%B3%84-%EC%8A%A4%ED%94%BC%ED%82%B9%EA%B3%B5%EB%B6%80-%EC%B2%98%EC%9D%8C%EC%9D%B8-%EC%9D%B8%EA%B0%84%EC%9D%B4-2%EC%A3%BC%EB%8F%85%ED%95%99%ED%95%B4%EC%84%9C-IH%EB%B0%9B%EC%9D%80-%ED%9B%84%EA%B8%B0#entry125comment</comments>
      <pubDate>Fri, 7 Jun 2024 22:35:46 +0900</pubDate>
    </item>
  </channel>
</rss>