<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dahee Lee on Medium]]></title>
        <description><![CDATA[Stories by Dahee Lee on Medium]]></description>
        <link>https://medium.com/@daheelee1114?source=rss-b0e97ff01aa8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Tcraqv0kYzNt_uGL6dUjBg@2x.jpeg</url>
            <title>Stories by Dahee Lee on Medium</title>
            <link>https://medium.com/@daheelee1114?source=rss-b0e97ff01aa8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 06:30:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daheelee1114/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[유저 타게팅은 어떻게 할까 : 데이터 기획]]></title>
            <link>https://daheelee1114.medium.com/%EC%9C%A0%EC%A0%80-%ED%83%80%EA%B2%8C%ED%8C%85%EC%9D%80-%EC%96%B4%EB%96%BB%EA%B2%8C-%ED%95%A0%EA%B9%8C-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EA%B8%B0%ED%9A%8D-32b6a057fbb7?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/32b6a057fbb7</guid>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[segmentation]]></category>
            <category><![CDATA[target-audience]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analysis]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 02:45:54 GMT</pubDate>
            <atom:updated>2023-11-22T02:50:43.705Z</atom:updated>
            <content:encoded><![CDATA[<h3>유저 타게팅은 어떻게 할까 : 데이터 기획</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pUw1hcvpu0JNn45r" /><figcaption>Photo by <a href="https://unsplash.com/@armoredsaint?utm_source=medium&amp;utm_medium=referral">Pablò</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>카카오톡의 수많은 비즈니스 채널이 우리에게 톡채널 메시지를 통한 광고를 하고 있다.</p><p>예를 들어, 채널 메시지를 생각해보자</p><p>올리브영은 11월 블랙프라이데이 관련 광고 메시지를 보내왔다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*LfBuTztxFE8Po5Yd_RdrDQ.png" /></figure><p>이러한 메시지를 보낼 때,</p><p>채널 친구 모두에게 발송할 수도 있고 30–40대 여성에게만 보낼 수도 있다.</p><p>여기서 좀 더 나아가 내가 원하는 특징을 갖고 있는 유저에게 타게팅을 해볼 수도 있을 것 같다. 올리브영을 많이 방문하는 헤비유저나 구매를 많이하는 코어유저 처럼 말이다.</p><p>위 예시는 특정 브랜드에 대한 것이었고</p><p>카카오에 대해서도 서비스와 사용성을 기준으로 유형을 나눠볼 수 있을 것이다.</p><p>프로필 사진을 많이 바꾸거나, 타인의 프로필을 많이 보거나, 관심사 기반의 오픈채팅을 많이 한다거나, 선물하기를 많이 하는 행동 말이다.</p><p>이를 통해 성향을 정의해 볼 수도 있을 것이다.</p><blockquote>프로필 사진을 많이 바꾼다 =&gt; 본인을 표현하기를 좋아하는 외향적인 사람</blockquote><blockquote>타인의 프로필을 많이 본다 =&gt; 타인의 소식을 궁금해 하는 사람</blockquote><blockquote>오픈채팅을 많이 하는 사람 =&gt; 특정 주제에 관심이 있는 사람</blockquote><blockquote>선물하기를 많이 하는 사람 =&gt; 쇼핑을 좋아하는 사람</blockquote><p>이런식으로 서비스와 행동에 따라 유형을 분류해 볼 수 있다.</p><p>이러한 유형을 분류하는 데이터를 만들면</p><p><strong>메시지 타게팅을 할 때 단순히 성별, 연령대만 고려하는게 아닌,</strong></p><p><strong>더욱 섬세한 타게팅이 가능하다.</strong></p><p>그렇다면 이러한 유형을 정의 할 때 필요한 데이터를 준비해야 한다.</p><p>서비스의 종류, 유저가 사용하는 기능들을 모아봐야 할텐데</p><p>앱/웹 내에서 발생할 수 있는 로그들을 쭉 살펴보고 정하면 된다.</p><blockquote>만약에,</blockquote><blockquote>쇼핑을 좋아하는 유저에게만 보내고 싶다면 어떨까?</blockquote><h3>유형 정의</h3><p>이러한 타게팅을 하기 위해서는,</p><ol><li>분류하고자하는 유형을 정의하고 =&gt; 쇼핑을 좋아하는 사람들</li><li>유형에 포함하고 싶은 기능을 고르면</li></ol><p>될 것 같다.</p><p>유형에 포함할 기능을 고르기 위해서는 먼저 ‘쇼핑&#39; 관련된 로그들을 쭉 살펴보는 것이다.</p><p>예를 들면,</p><blockquote>쇼핑 탭을 누르는 횟수 : (예) 한 달에 30회</blockquote><blockquote>탭에 머무는 시간 : (예) 한 달 평균 30초</blockquote><blockquote>탭에서 광고 배너나 메뉴를 선택하는 횟수 : (예) 한 달 평균 3회</blockquote><blockquote>선물하기를 하는 횟수 : (예) 한 달에 3회</blockquote><p>등등이 있을 것 같다.</p><p>위 기능들은 쇼핑과 관련된 것으로써 고려해볼 수 있는 기능의 종류들이다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HwQ6kUCInp3h0nLQ8iFXVQ.png" /><figcaption>카카오톡 쇼핑 탭 화면</figcaption></figure><h3>테이블 만들기</h3><p>기능들을 리스트업 했다면,</p><p>해당 기능들의 로그가 잘 남는지, 지속적으로 안정적으로 남는지, NULL 값이나 이상치는 없는지, 분포가 고른지 먼저 체크를 해야한다.</p><p>유형을 한 번만 만들어 쓰는게 아니라 지속적으로 사용할 것이라면 트래킹이 필요하기 때문이다.</p><p>이제 로그를 참고하여 쿼리를 짜면 되고 테이블의 형태는 user_id에 각 기능에 대한 값을 붙이는 것이다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nzzqg1TWlzuk4iYvUw3gMQ.png" /><figcaption>테이블 샘플</figcaption></figure><h3>스코어링</h3><p>이제 각 기능을 조합해서 쇼핑 유형에 대한 스코어를 만들어 볼 수 있을 것이다. 스코어가 높다면 쇼핑을 좋아하고 많이 구매 하는 사람으로 볼 수 있을 것이다.</p><p>스코어를 계산하기 위해서는 3가지 고려할 사항이 있다</p><ol><li><strong>정규화</strong> (숫자의 범주나, 값의 형태가 다 다르기 때문, min max scaling)</li><li><strong>아웃라이어 정리(이상치에 대한 </strong>Ceiling<strong>값 적용)</strong></li><li><strong>중요도</strong> 여부 결정</li></ol><p>위 3가지를 잘 해결한 후, 아래 처럼 스코어를 계산하면 된다.</p><blockquote><strong>shopping score = variable value * weight</strong></blockquote><p>(추가로, 스코어도 0–1 사이의 정규화가 필요하다면 정규화를 하면 된다)</p><p>그럼 쇼핑을 좋아할, 쇼핑할 가능성이 높은 유저를 대상으로 타게팅 한다면,</p><p>스코어가 높은 유저에게 보내면 되는 것이다!</p><h3>유형 헤비유저 정의</h3><p>그렇다면 스코어가 높은 유저인 헤비유저 기준은 어떻게 판단할 수 있을까</p><p>헤비 유저라고 볼 수 있는 스코어와 유저수 비율 기준을 정하고 이를 참고하면 된다.</p><p>이는 스코어에 따른 유저의 분포를 먼저 살펴보고, 해당 기능의 사용성을 주관적 판단 아래 기준을 정해볼 수 있을 것이다.</p><p>예를 들어,</p><blockquote>스코어 0.8점 이상</blockquote><blockquote>유저 수 기준 상위 5% 유저에게만 보낸다거나</blockquote><p>원하는 모수에 따라 기준을 적용해서 보내면 된다.</p><p>(여기서 더 상세하게 들어간다면 기능 사용성도 필터해서 보낼 수 있다.)</p><p>이렇듯 유형과 기능 사용성 정도에 따라 원하는 유저를 타게팅 할 수 있고</p><p>이러한 타게팅을 통해 랜덤 유저보다 높은 열람, 클릭, 구매를 기대해 볼 수 있다.</p><p>유형을 만든 후에는 필요에 따라</p><p>대시보드를 만들어 데이터에 대한 이해도를 높이고 데이터 활용을 높일 수 있다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NkwHFHOh6i0VvuSx" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>다음 글에서는</p><p>하나의 서비스를 예시로 하여 데이터를 기획하고 대시보드를 만들어 보도록 하겠다!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32b6a057fbb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3월 일상 이야기 및 메모]]></title>
            <link>https://daheelee1114.medium.com/3%EC%9B%94-%EC%9D%BC%EC%83%81-%EC%9D%B4%EC%95%BC%EA%B8%B0-%EB%B0%8F-%EB%A9%94%EB%AA%A8-9f51d7f9e1f0?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f51d7f9e1f0</guid>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Tue, 14 Mar 2023 04:51:56 GMT</pubDate>
            <atom:updated>2023-03-14T04:51:56.768Z</atom:updated>
            <content:encoded><![CDATA[<p>3월 14일 화요일</p><p>일어나자마자 출근을 했다. 오늘은 왜인지 아몬드 우유가 들어간 커피를 마시고 싶었다. 아침 일찍부터 카맵쪽과 협업하는 미팅이 있었는데 새로운 프로젝트를 진행하게 되어 설레인다. 새로운 공부를 하게 되는 것도!</p><p>세상에 어려운 것들이 너무 많다. 많은 퀘스트들을 깨면서 살아가는 인생.</p><p>혼자 다 해낼 수는 없다. 누구와 함께 하는지가 중요하구나!</p><p>원하는 라이프, 생각하는 방향, 수용 가능한 범위</p><p>이러한 디테일한 결이 맞는 사람들과 함께 할 때 서로 좋은 에너지를 주고 받아 각자의 유니버스가 확장될 수 있는 것 같다. 또 인생이 즐거워지기도 하고.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0sOosZnSyYh38mmGQu8YA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f51d7f9e1f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2022 회고 : 커리어]]></title>
            <link>https://daheelee1114.medium.com/2022-%ED%9A%8C%EA%B3%A0-%EC%BB%A4%EB%A6%AC%EC%96%B4-6edc32db748b?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6edc32db748b</guid>
            <category><![CDATA[데이터분석]]></category>
            <category><![CDATA[태블로]]></category>
            <category><![CDATA[회고]]></category>
            <category><![CDATA[커리어]]></category>
            <category><![CDATA[2022]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Sat, 17 Dec 2022 05:48:45 GMT</pubDate>
            <atom:updated>2022-12-17T05:52:23.139Z</atom:updated>
            <content:encoded><![CDATA[<h3>2022 회고 : 커리어</h3><p>2022년이 아직도 어색한데 내년은 2023 이다. 올 해는 왜인지 회고를 하면서 한 해를 돌아보고 또 기록도 해놓고 싶었다. 유독 고민이 많았고 해결하고 싶은 마음이 컸고 나름의 여러가지 시도를 해보았고 결국 답은 단순 했고 나도 알고 있었던 것 같다. <strong>다 필요했던 과정</strong>이기에 아쉬움과 후회는 없다.</p><p>더 성숙해진 한 해여서 <strong>오히려 좋음</strong>ㅎㅎ</p><h4><strong>1. 스테이지 업 (3월)</strong></h4><p>회사에 그로스 스테이지 제도가 있다. 역량에 따라 입사 시 스테이지가 부여 되는데 그동안의 업무 성과를 바탕으로 본인과 직속 리더가 판단하여 스테이지 업을 신청해 볼 수 있다. 인사실에서 작업 했던 과제와 스테이지 업에 필요한 역량을 자기소개서 쓰듯 정리하는 시간이 필요했다. 팀 리더분들이 스테이지 업에 대해 먼저 이야기도 주시고 신청서 작성에도 상세한 피드백을 주셔서 지원해 볼 수 있는 기회를 가져볼 수 있었다. <br><strong>기쁘게도 결과는 스테이지 업!🥺 </strong><br>신청서를 작성하면서 그동안의 업무 결과물을 정리하는 시간과 역량을 인정 받았다는 뿌듯함과 보상에도 영향이 있어서 기분이 좋았다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*zjFeSXL7mSnWQ4oHSIhWBg.png" /></figure><h4>2. 부서 이동과 직군 변경 (6월)</h4><p>상반기에 조직 변경, 업무 변경이 있었다. 리더가 바뀌면 업무의 방향성도 많이 달라질 수 있구나를 경험하고 내가 하는 업무가 과연 원했던 것일까 하는 고민이 찾아왔다. 다들 역량이 뛰어나시고 본받고 싶은 동료 분들로 구성된 팀이었는데 모두가 흩어지면서 아쉬움은 커지고 혼란은 가중 되었던 것 같다. 그러던 중 회사에 부서이동 제도가 시작 되었는데 서비스 데이터를 분석해 볼 수 있는 부서로 지원을 해보고 싶다는 생각이 들었다. 팀 분들에게 말씀을 드렸더니 이동에 대한 격려와 응원도 해주셔서 죄송하면서도 감사했다. 마치 이직하듯이 지원서 작성을 했고 과제도 수행하고 면접도 2번 진행 되었다. 캘린더 안에 당시 부서 업무와 부서 이동을 위한 일정들이 같이 있으니 기분이 참 미묘했다. 부서 이동이 되면 규모가 큰 데이터도 접해볼 수 있고 쿼리도 더 공부해볼 수 있는 환경이 주어질 것 같아 긍정적으로 결과를 기대해 보았다. 면접 당시 쿼리에 대한 경험은 부족하지만 조직 내에 시각화에 대한 수요가 있다고 말씀 주시면서 이동이 승인 되었다. 이직과도 같았던 부서 이동이었다. 첫 몇 달은 새로운 조직에 적응도 해야하고 재택 환경 속에서 데이터에 접근하고 이해하는 과정은 쉽지 않았다. 모르는 것 투성이었고 과연 여기서 내 몫을 해낼 수 있을까 하는 걱정이 크게 찾아왔던 것 같다. 다행히 팀 분들이 잘 도와주신 덕분에 지금은 잘 적응해 나가고 있다.😁</p><p>직군이 스태프에서 테크로 변경되는 경우였기에 3개월의 수습기간이 필요 했다. 같은 팀 내에 테크 직군 동료들을 보면 다들 엄청난 실력으로 업무를 수행해 내는 것을 보고 과연 직군 변경이 될 수 있을까 하는 마음에 스트레스도 함께 있었던 것 같다. 평가의 연속의 삶이란.. 결과적으로는 직군도 테크로 변경되고 스테이지도 조정되고 이에 맞춰서 약간의 보상 조정도 있었다. 현 부서의 리더 분들이 직군 변경 결정을 해주시고 전 부서 동료 분들이 변경 관련해서 세심하게 잘 챙겨주셔서 감사한 마음이 들었다. 회사 생활을 하면서 인연이 닿는 동료 분들이 다들 좋은 분들이셔서 참 감사하고 소중하다.</p><p>쭉 정리하고 나니 상황은 계속 변하는 것 같다. 예측이 불가한 상황에서 나는 지속적으로 선택하고 행동해 나가야만 한다. 변화를 예측할 수 없으니 더더욱 <strong>현재에 집중하고 즐겨야 하는 것</strong> 같기도 하고.</p><h4>3. 사내 경진대회 (8월)</h4><p>사내 태블로 경진대회가 있었다. 이 얼마 만에 대회인지! 사실 태블로 역량 덕분에 부서 이동할 수 있었던 기회가 주어졌던 것 같다. 이직도 말이다. 경진대회에 나가서 수상을 해야만 할 것 같은 부담과 나에게도 역량을 더 발전시켜볼 수 있는 좋은 기회라고 생각했고 혼자 하기 보다는 팀내에 나와 같이 부서 이동을 하신 분들도 관심이 있다면 같이 해보면 시너지도 나고 좋을 것 같았다. 다행히도 먼저 제안을 주신 분도 있었고 여쭤봤을 때 흔쾌히 수락을 해주셔서 아이디어 회의도 하고 기획도 하고 대시보드도 만들고 피드백 수정도 하고 어쩌면 업무 진행하는 것 보다 더 큰 부담감을 안고 준비를 했다. 쿼리나 분석 역량이 한참 부족하여 자신감이 많이 떨어진 상태 였는데 이 경진대회에서 수상하면 시각화에 대한 업무 능력도 증명이 되고 팀 내에서 몫을 해낼 수 있는 역량을 보여줄 수 있어 내 마음이 좀 더 편해질까 싶기도 했다. 좋아요상, 테크니컬상, 스토리텔링상이 있었는데 정말 감사하게도 좋아요상과 테크니컬상 2개를 받게 되었다! 아.. 하나는 해냈다.. 이런 안도감과 함께 준비하면서 느꼈던 부담감이 가라앉혀졌고 응원해준 팀 분들, 같이 진행한 분들과 함께 기쁨을 나누었다. 할 때는 부담스럽고 스트레스가 있었지만 좋은 결과를 마주하니 정-말 뿌듯하고 성취감이 짜릿한 행복을 가져다 주었다.</p><p><strong>역시 하길 잘했다!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBleCZGG1efLj2vDjhMGJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GK8Yo71Ighz9F71Yu3miYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*0ehirMYtXkP9CGjSZ4Jlow.png" /></figure><h4>4. 프로젝트 (10월)</h4><p>한창 프로젝트를 진행하고 있다. 그동안 서비스에서 데이터는 어떤 것들이 남는지, 로그 데이터는 어떻게 생겼는지, 어느 디비에 어떤 형태로 저장되고 있는지 등 파악하는데 필요한 데이터 서칭 업무를 진행했다. 그 이후에는 사업부와 함께 하는 프로젝트에 투입이 되었는데 내가 맡은 역할은 팀에서 만든 분석 결과물을 시각화하여 대시보드로 만드는 것이었다. 이 자료는 현황을 파악하거나 지표를 트래킹하고 기획자나 마케터가 쿼리로 날리기 어렵고 복잡한 것들을 대시보드에서 동작을 통해 바로 확인할 수 있도록 하는 용도로 만들었다. 어려웠던 점은 로그 단위의 데이터를 말고 말고 또 말아 대시보드에서 보여줘야 하는 값으로 집계를 하는 테이블을 만드는 것, 추가적인 기능을 구현하기 위해 필요한 데이터를 최대한 빠르게 불러 올 수 있도록 테이블 형태를 최적화 하는 것이었다. 프로젝트원 분들과 머리를 맞대고 이런 저런 시도 끝에 처음엔 다 안 될 것 같은 화면을 구현할 수 있었고 실제 유저가 불편함 없이 사용할 수 있는 수준의 성능으로도 개선할 수 있었다. 태블로에 적합한 형태로 테이블을 만드는 것에 대한 어려움이 컸는데 모두 적극적으로 함께 고민해주고 도와주셔서 개선이 가능했던 것 같아 감사하다. 기한이 계속 촉박한 업무라 한창 야근도 많이 하고 빠르게 대응해야하기도 했지만 <strong>늘 그렇듯 힘든 실전에서 더 빠르게 배울 수 있게 되는 것 같다.ㅎㅎ</strong> 이번 프로젝트는 계속해서 확장되어 진행 되고 있는데 내년에는 A/B테스트, 분석, 결과를 바탕으로 서비스가 개선되는 경험도 함께 할 수 있다면 정말 짜릿할 것 같다.</p><h4>5. 멘토링 &amp; 강연 &amp; 컨퍼런스 &amp; 책</h4><p>회사 업무 외에도 지속적으로 태블로 관련된 외부 활동들을 하고 있다. 좋은 자극제가 되는 것 같아서 좋다. 사내에서는 태블로를 고독하게 사용하는 느낌이라 외부에서 비슷한 업무를 하는 분들과 대화를 나눌 때면 참 반갑다. <strong>역시 공감은 사람을 편안하게 하는 것일까. </strong>3월에는 진학사에서 진행하는 커리어 강연을 하게 되었다. 데이터 분석가라는 타이틀로 취업 준비부터 지금 하는 업무까지 소개하는 내용이었는데 강연을 준비하면서 한편으로는 과연 나의 스토리가 도움이 될 수 있을까 하는 걱정이 되었다. 과거에 한창 취업을 준비할 때 유튜브로 그들은 어떤 방식으로 공부를 해서 일을 하게 되었는지에 대한 스토리를 듣는 것이 흥미로웠고 그런 데이터 관련 유튜브를 보는 것이 나에게는 큰 동기부여가 되었었다. 데이터 분석 안에서도 전문 분야들이 다양하게 나뉘는데 그 중에서도 시각화에 중점을 둔 내용이 누군가에게는 흥미롭고 얻어가는 정보가 있었으면 하는 바람에서 자료를 만들고 발표를 진행했다. 강연 신청자가 500명 가까이 되었다. 오프라인으로 발표해야 했다면 엄-청 떨렸을 것 같다. 다행히도 질의응답 시간에 시각화에 대한 관심과 질문들을 많이 주셔서 누군가에게는 정보를 얻어갈 수 있는 소중한 시간이 될 수 있어서 기쁘고 뿌듯했다. 그 이후로도 좋은 인연이 닿아 데이터 시각화 스터디에 멘토링 활동도 꾸준히 해오고 있다. 멘토링 활동을 하다 보면 시각화 툴을 다루는 방법뿐만 아니라 시각화의 중요성에 대해서 다시 한번 정리해 볼 수 있고 그들이 진행한 내용들을 보면서 새로운 시각을 배울 수 있어 뜻깊은 시간들이다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0d6Gr7ZkN2q8YFLCTQuug.png" /></figure><p>취준 시절 태블로 커뮤니티에서 연이 닿은 분들이 태블로 관련 책을 출판하는데 좋은 기회로 서면 인터뷰에 참여하게 되었다. 태블로와 관련된 경험에 대한 1장의 짧은 인터뷰였고 이 내용이 책에 실린다는 것이 신기했다. 책을 내보고 싶다는 생각은 2년 전만해도 전혀 없었는데 언젠간 나도 기회가 된다면 내가 진심으로 공감하고 기억하고 싶은 부분에 대해서 글을 남겨보고 싶다는 생각이 요즘은 문득 든다. <strong>상상을 하다 보면 언젠간 실현이 되지 않을까?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEQdm4y06ZFqAbbZ7CCz3A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6edc32db748b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[파이썬 파일 배치 돌리기-자동화]]></title>
            <link>https://daheelee1114.medium.com/%ED%8C%8C%EC%9D%B4%EC%8D%AC-%ED%8C%8C%EC%9D%BC-%EB%B0%B0%EC%B9%98-%EB%8F%8C%EB%A6%AC%EA%B8%B0-%EC%9E%90%EB%8F%99%ED%99%94-c34428eecf55?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c34428eecf55</guid>
            <category><![CDATA[crontab]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 11:08:20 GMT</pubDate>
            <atom:updated>2021-06-03T11:08:20.029Z</atom:updated>
            <content:encoded><![CDATA[<p>API로 받은 데이터를 자동 업데이트 되도록 해보자.</p><p>생각보다 아주 간단 했고 그동안 데이터 수동 업데이트한 나는 바..보..</p><p>맥에서 자동화는 <a href="https://crontab.guru/"><strong>cron</strong></a>을 이용하면 된다.</p><p>크론은 유닉스 계열 컴퓨터 운영 체제의 시간 기반 잡 스케줄러라고 한다.</p><p>지정된 시간에 주기적으로 실행할 수 있도록 하려면 크론을 사용하면 된다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*w4nTCDsde9iLgeC25WCHZQ.png" /></figure><p><strong>순서는 다음과 같다.</strong></p><h4><strong>1. 터미널에서 </strong><strong>crontab -e</strong> <strong>를 입력한다.</strong></h4><p>크론 목록을 수정하는 명령어로 해당 명령어를 입력하면 에디터가 열린다.</p><pre>crontab -e</pre><h4><strong>2. i 키를 입력해서 에디터 모드로 전환한다.</strong></h4><h4><strong>3. 다음과 같이 작성한다. (이 부분이 중요함)</strong></h4><p>[ 파일 실행 주기, 파이썬 경로, 파일 경로 ]</p><p>위 3가지를 입력하는데 여기서 중요한 점은 실행 주기는 크론이 만들어놓은 규칙을 따라야 한다.</p><blockquote><strong>순서 : 분 시 일 월 요일</strong></blockquote><blockquote><strong>공백으로 구분</strong></blockquote><blockquote><strong>A부터 B까지 모두 포함할 때는 -를 사이에 둠</strong></blockquote><blockquote><strong>특정 시간을 지정할 때는 ,를 사이에 둠</strong></blockquote><blockquote><strong>모두 포함할 대는 *를 사용</strong></blockquote><p>예를 들어, 매일 10시에 실행한다면 0 10 * * * 이런식으로 작성하면 되는데</p><p><a href="https://crontab.guru/examples.html">이 링크</a>에서 예시들을 좀 더 참고할 수 있다.</p><pre>0 10 * * * [파이썬 경로] [실행할 파이썬 파일 경로]</pre><h4><strong>4. </strong><strong>esc를 눌러 명령 모드로 전환하고 </strong><strong>:wq를 입력하고 </strong><strong>enter 키를 입력하여 저장 후 종료한다.</strong></h4><h4><strong>5. 터미널에서 </strong><strong>crontab -l</strong> <strong>를 입력하고 저장된 것을 확인한다.</strong></h4><h4><strong>끝!</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c34428eecf55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[코로나 데이터 오픈 API로 가져오기]]></title>
            <link>https://daheelee1114.medium.com/%EC%BD%94%EB%A1%9C%EB%82%98-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%98%A4%ED%94%88-api%EB%A1%9C-%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0-7b53f94f9a6d?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b53f94f9a6d</guid>
            <category><![CDATA[코로나]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 14:12:23 GMT</pubDate>
            <atom:updated>2021-06-03T11:09:16.768Z</atom:updated>
            <content:encoded><![CDATA[<p>끝나긴 끝나는 건지 모르겠는…코..로..나..</p><p>이제와서 기록해보는 공공데이터포탈의 오픈 API로 코로나 데이터 가져오기를 기록해 본다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ACO59Q0_4ATr2mBa" /><figcaption>Photo by <a href="https://unsplash.com/@mjessier?utm_source=medium&amp;utm_medium=referral">Myriam Jessier</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>데이터는 <a href="https://www.data.go.kr/index.do">공공데이터포털</a>에서 가져올 수 있고</p><p>실제로 ‘코로나&#39;를 키워드로 검색해보면 총 123건의 다~양한 코로나 관련 데이터를 제공하고 있다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*60peTfyCclWL3QJcJHH_Tw.png" /><figcaption>2021.06 기준</figcaption></figure><p>시도해 본 데이터는 <a href="https://www.data.go.kr/data/15043378/openapi.do"><strong>코로나19 시·도발생 현황</strong></a>으로 해당 데이터를 가져오는 방법을 기록해 보도록 하겠다. (다른 데이터도 url만 다를뿐 동일하게 적용하면 된다)</p><ol><li><strong>먼저 아래 링크에서 활용신청을 하고 키를 발급 받는다.</strong></li></ol><p><a href="https://www.data.go.kr/data/15043378/openapi.do">https://www.data.go.kr/data/15043378/openapi.do</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BqMpw_-KFcW4SWrsIU8pbg.png" /></figure><p><strong>2. 발급받은 키를 확인한다. (일반 인증키 사용)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*OPI_HKUUtflNwuVdB7cCow.png" /></figure><p><strong>3. 파이썬에서 필요한 패키지를 불러 온다.</strong></p><pre>from urllib.parse import urlencode, quote_plus, unquote<br>import requests<br>import json<br>import xmltodict<br>import pandas as pd</pre><p><strong>4. URL에 필요한 키와 파라미터 값을 넣어 호출해 본다.</strong></p><p>여기서 필요한 파라미터 값들은 위 활용신청 하는 페이지에서 좀 더 자세하게 확인할 수 있다.</p><pre>key = &#39;발급받은 키&#39;</pre><pre>url = f&#39;http://openapi.data.go.kr/openapi/service/rest/Covid19/getCovid19SidoInfStateJson?serviceKey={key}&amp;&#39;</pre><pre>queryParams = urlencode({ quote_plus(&#39;pageNo&#39;) : &#39;1&#39;, quote_plus(&#39;numOfRows&#39;) : &#39;10&#39;, quote_plus(&#39;startCreateDt&#39;) : &#39;20200201&#39;, quote_plus(&#39;endCreateDt&#39;) : &#39;20210531&#39; })</pre><pre>res = requests.get(url + queryParams)<br>print(res)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhSPFJsJxp0ue60TqQbRCA.png" /></figure><p><strong>5. Dictionary 형식으로 변환한다.</strong></p><pre># 문자열 XML을 JSON 형식으로 변환합니다.<br>res_json = xmltodict.parse(res.text) </pre><pre># 변환된 JSON 형식을 Dictionary 문자열로 변환합니다.<br>res_dict = json.dumps(res_json)     </pre><pre># Dictionary 문자열을 파이썬의 Dictionary 형식으로 변환합니다.<br>data = json.loads(res_dict)</pre><pre>len(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;]) #8005개 </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pA_9LvxCN_sIdzwW3h7_7Q.png" /></figure><p><strong>6. 필요한 컬럼을 리스트로 먼저 만들어 놓는다.</strong></p><p><a href="https://www.data.go.kr/data/15043378/openapi.do">컬럼 정보는 아래와 같다.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*wpkT_Y2eokSP6TtHF5jEAg.png" /></figure><pre>createDt_list = []<br>deathCnt_list = []<br>defCnt_list = []<br>gubun_list = []<br>incDec_list = []<br>isolClearCnt_list = []<br>isolIngCnt_list = []<br>localOccCnt_list = []<br>overFlowCnt_list = []<br>qurRate_list = []<br>seq_list = []<br>stdDay_list = []<br>updateDt_list = []</pre><p><strong>6. 딕셔너리에서 아이템 개수만큼 반복문을 돌려 필요한 데이터를 위에서 만든 리스트에 저장한다.</strong></p><p>종종 데이터가 안들어 있어 에러가 발생하기도 하여 try catch로 감싸서 진행했다.</p><pre>for i in range(len(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;])):  <br>        try : createDt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;createDt&#39;])<br>        except KeyError : createDt_list.append(&#39;&#39;)<br><br>        try : deathCnt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;deathCnt&#39;])<br>        except KeyError : deathCnt_list.append(&#39;&#39;)<br><br>        try : defCnt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;defCnt&#39;])<br>        except KeyError : defCnt_list.append(&#39;&#39;)<br><br>        try : gubun_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;gubun&#39;])<br>        except KeyError : gubun_list.append(&#39;&#39;)<br><br>        try : incDec_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;incDec&#39;])<br>        except KeyError : incDec_list.append(&#39;&#39;)<br><br>        try : isolClearCnt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;isolClearCnt&#39;])<br>        except KeyError : isolClearCnt_list.append(&#39;&#39;)<br><br>        try : isolIngCnt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;isolIngCnt&#39;])<br>        except KeyError : isolIngCnt_list.append(&#39;&#39;)<br><br>        try : localOccCnt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;localOccCnt&#39;])<br>        except KeyError:localOccCnt_list.append(&#39;&#39;)<br><br>        try :  overFlowCnt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;overFlowCnt&#39;])<br>        except KeyError:overFlowCnt_list.append(&#39;&#39;)<br><br>        try: qurRate_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;qurRate&#39;])<br>        except KeyError:qurRate_list.append(&#39;&#39;)<br><br>        try: seq_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;seq&#39;])<br>        except KeyError:seq_list.append(&#39;&#39;)<br><br>        try: stdDay_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;stdDay&#39;])<br>        except KeyError: stdDay_list.append(&#39;&#39;)<br><br>        try: updateDt_list.append(data[&#39;response&#39;][&#39;body&#39;][&#39;items&#39;][&#39;item&#39;][i][&#39;updateDt&#39;])<br>        except KeyError: updateDt_list.append(&#39;&#39;)</pre><p><strong>7. 위 리스트들로 데이터프레임을 만들고 저장한다.</strong></p><pre>dataframe = pd.DataFrame()<br>dataframe[&#39;createDt&#39;] = createDt_list<br>dataframe[&#39;deathCnt&#39;] = deathCnt_list<br>dataframe[&#39;defCnt&#39;] = defCnt_list<br>dataframe[&#39;gubun&#39;] = gubun_list<br>dataframe[&#39;incDec&#39;] = incDec_list<br>dataframe[&#39;isolClearCnt&#39;] = isolClearCnt_list<br>dataframe[&#39;isolIngCnt&#39;] = isolIngCnt_list<br>dataframe[&#39;localOccCnt&#39;] = localOccCnt_list<br>dataframe[&#39;overFlowCnt&#39;] = overFlowCnt_list<br>dataframe[&#39;qurRate&#39;] = qurRate_list<br>dataframe[&#39;seq&#39;] = seq_list<br>dataframe[&#39;stdDay&#39;] = stdDay_list<br>dataframe[&#39;updateDt&#39;] = updateDt_list</pre><pre>dataframe.to_excel(&#39;코로나 19 감염 시도 현황.xlsx&#39;, index=False)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZummMPO-BHOb0y2nEkkDaQ.png" /></figure><p>진행하면서 어려웠던 점은</p><ul><li>key 에러 (인코딩 문제)</li><li>반복문 에러 (데이터가 비어있는 문제)</li></ul><p>위 2가지 였는데… 이번에 배웠으니 API로 다른 데이터 가져올 때는 잘 넘어갈 수 있을 것이라는 것에 의의를 둬본다.</p><p>다음은 해당 <a href="https://daheelee1114.medium.com/%ED%8C%8C%EC%9D%B4%EC%8D%AC-%ED%8C%8C%EC%9D%BC-%EB%B0%B0%EC%B9%98-%EB%8F%8C%EB%A6%AC%EA%B8%B0-%EC%9E%90%EB%8F%99%ED%99%94-c34428eecf55"><strong>파이썬 파일을 배치로 돌려 자동으로 데이터를 업데이트</strong></a>할 수 있도록 해보아야 겠다!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b53f94f9a6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Preprocessing & Data Modeling]]></title>
            <link>https://daheelee1114.medium.com/data-preprocessing-data-modeling-40d8fa6fad64?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/40d8fa6fad64</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-preprocessing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-modeling]]></category>
            <category><![CDATA[spotify]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 11:42:41 GMT</pubDate>
            <atom:updated>2020-04-23T12:05:30.355Z</atom:updated>
            <content:encoded><![CDATA[<p>앞에서 스크랩 한 2가지 데이터를 이제 전처리하고 모델링하여 분석에 적합한 구조로 만들어야 한다.</p><blockquote><a href="https://medium.com/@daheelee1114/2020%EB%85%84%EA%B3%BC-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EC%8B%9C%EC%9E%91-849d7722a2e5"><strong><em>1. Spotify TOP 200</em></strong></a></blockquote><blockquote><a href="https://medium.com/@daheelee1114/spotifyr%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%88%98%EC%A7%91-c2fd2a53421f"><strong><em>2. Audio Features by Track</em></strong></a></blockquote><h3>1. 데이터 불러오기</h3><p>먼저 US만 필터한 <a href="https://medium.com/@daheelee1114/2020%EB%85%84%EA%B3%BC-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EC%8B%9C%EC%9E%91-849d7722a2e5"><strong><em>Spotify TOP 200</em></strong></a>의 데이터를 불러오고 <strong>a </strong>이름으로 데이터 프레임을 저장 한 뒤 읽어본다.</p><p>(데이터 프레임 이름 붙이는거… 고민하기 싫어서 a,a1,a2,a3…. b,b1,b2,b3 이런식으로 했는데 나중에 고쳐야겠다)</p><p>(2017–2019년 US Daily Top 200 리스트로 총 8개 컬럼 218200행이다. )</p><pre>a = pd.read_csv(&#39;/Users/dahee/Desktop/Project_dahee/spotify/Data/us/spotify_us.csv&#39;)</pre><pre>a.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CF70PYPIUccXRo_2To5sXA.jpeg" /></figure><p>이번엔 각 곡의 오디오 정보를 담고 있는 <a href="https://medium.com/@daheelee1114/spotifyr%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%88%98%EC%A7%91-c2fd2a53421f"><strong><em>Audio Features by Track</em></strong></a>의 데이터를 불러오고 <strong>b </strong>이름으로 데이터 프레임을 저장 한 뒤 읽어본다.</p><p>(총 19개 컬럼 62596행이다.)</p><pre>b = pd.read_csv(&#39;/Users/dahee/Desktop/Project_dahee/spotify/Data/audio_features.csv&#39;)</pre><pre>b.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4IUqtDc5g_ayIJzuYQMdtQ.jpeg" /></figure><h3>2. 데이터 가공</h3><p>데이터를 가공하기 전에 한번 확인을 해보자.</p><p><strong>a</strong>에서 <strong>Artist</strong>가 <strong>Drake</strong>인 것만 필터해서 보면 아래와 같다.</p><p>각 곡의 특징으로 클러스터링을 해야하는데 지금 데이터를 보면 각 일자별로 God’s Plan이 여러행 있다. 이러면 안된다. 왜냐? 각 곡당 레코드가 1줄씩 있어야하기 때문이다. 그렇다고 레코드 1개만 나누고 걍 랜덤으로 지운다? 그러면 또 안된다. Streams를 무시할 수 없기 때문이다. (나중에 스트리밍 수로도 추가 분석 또는 화면에 나타내면 분석의 깊이를 더할 수 있으니까&gt;.&lt;)</p><p>암튼 그래서 해야되는것은 group by 이다.</p><pre>a[a[&#39;Artist&#39;] == &#39;Drake&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CiwL_MrIYTudWgiHeRN7MA.jpeg" /></figure><p>먼저 무엇을 기준으로 group by 해야하는지 알아야한다.</p><p>그것은 바로 URL에 있다.</p><p>이전에 데이터 스크랩하면서 살펴보았듯이, URL 마지막 슬래시 다음에 있는 것이 각 곡의 유니크한 ID이다.</p><p>즉, ID를 기준으로 group by 하면 된다.</p><p>그럼 URL 필드에서 ID를 꺼내보자.</p><p>URL의 데이터 타입은 object이니 이를 먼저 str으로 바꾸고 슬래시를 기준으로 split 한 뒤 4번째 요소를 빼오면 그것이 바로 ID.</p><pre>a.URL.str.split(&#39;/&#39;).str[4]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*s575El8meKO2Nf3NEYRBGw.jpeg" /></figure><p>이렇게 뺀 ID를 새로운 컬럼으로 추가한다.</p><p>info를 보면, 총 9개 컬럼으로 맨 마지막에 id 항목이 추가되었다.</p><pre>a[&#39;id&#39;] = a.URL.str.split(&#39;/&#39;).str[4]<br>a.info()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*nlZqWBNq3Gm-_UZJH_7Ang.jpeg" /></figure><p>이제 진짜 group by!</p><p>Artist, Track, id를 기준으로 group by 하는데 이 때 Streams, Rank 와 같은 측정값은 sum, mean으로 집계한다. 그리고 a2 이름으로 저장한다.</p><p>(이제부터 시작되는 a + number…)</p><p>한번 봐보면 아래 이미지와 같다. 근데 좀 Artist, Track, id 필드명 위치와 Streams, Rank 위치가 약간 다르다.</p><pre>a2 = a.groupby([&#39;Artist&#39;, &#39;Track&#39;, &#39;id&#39;]).agg({&#39;Streams&#39;: &#39;sum&#39;, &#39;Rank&#39;: &#39;mean&#39;})<br>a2.head(10)<br>a2.info</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*Q17X6A13uNsVkiQZK-HGUg.jpeg" /></figure><p>group by를 하면 그 기준이 index가 된다. 이 index를 reset 해줘야 한다.</p><p>index level을 설정한 뒤 이를 a3에 저장하고 한번 확인해본다.</p><pre>a3 = a2.reset_index(level=[&#39;Artist&#39;, &#39;Track&#39;, &#39;id&#39;])  <br>a3[a3[&#39;Artist&#39;] == &#39;Drake&#39;]  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*tAaN7sRCEuRTUj5b_rQGGA.jpeg" /></figure><p>info 로도 봐보면, 총 5개 컬럼으로 잘 되어 있다.</p><pre>a3.info()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*b5JnNlrbepyS-BauwS0MNg.jpeg" /></figure><h3>3. 데이터 모델링</h3><p>이제 2개의 데이터를 조인해서 1개의 데이터 원본으로 만들어 분석에 적합한 데이터 구조로 만들어야 한다. ( a3 + b)</p><p>a3를 기준으로 Left Join 할 것이고 이 때 Key는 ‘id’ 필드이다.</p><p>(python에서 join 코드는 너무나도 간단하고 빨라서 놀람 tmi)</p><p>결과는 a4라는 이름으로 저장한다.</p><pre>a4 = a3.merge(b, on=&#39;id&#39;, how=&#39;left&#39;)<br>a4.head()<br>a4[a4[&#39;Artist&#39;]==&#39;Drake&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCuu5lWHabI09UTpNpIhig.jpeg" /></figure><p>불필요한 필드들이 몇 개 있는 것 같아 drop 하고 a5에 저장한다.</p><pre>a5 = a4.drop(columns=[&quot;Unnamed: 0&quot;, &quot;type&quot;, &quot;uri&quot;, &quot;track_href&quot;, &quot;analysis_url&quot;])<br>a5.info()</pre><p>분석에 오류를 막기 위해, null이 있는 행을 삭제하고 a6에 저장한다.</p><pre>a6 = a5.dropna()</pre><p>a6로 분석에 적합한 데이터 모델이 완성되었다.</p><p>각 곡에 총 3개년 스트리밍수, 평균 순위, 오디오 특징을 확인할 수 있는 데이터가 되었다.</p><p>데이터 스크랩, 데이터 전처리, 데이터 모델링까지 되었으니</p><p>이제 드디어, 정말루, 분석할 수 있다!!!!!!</p><p>다음 글에서는,</p><p>위 데이터 모델을 이용해서 Python에서 먼저 클러스터링한 것과</p><p>Tableau에서도 Tabpy를 활용하여 클러스터링한 것을 작성할 것이다.</p><p>#갑자기 #열정 #대방출</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40d8fa6fad64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spotifyr을 이용한 데이터 수집]]></title>
            <link>https://daheelee1114.medium.com/spotifyr%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%88%98%EC%A7%91-c2fd2a53421f?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2fd2a53421f</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[spotifyr]]></category>
            <category><![CDATA[spotify]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Fri, 14 Feb 2020 01:20:48 GMT</pubDate>
            <atom:updated>2020-02-14T10:04:01.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g7ldpbfnV2b_tQM_" /><figcaption>Photo by <a href="https://unsplash.com/@sincerelymedia?utm_source=medium&amp;utm_medium=referral">Sincerely Media</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Spotify TOP 200의 데이터를 다 스크랩 하고나니</p><p>그 다음에 또 궁금한건 각 트랙의 특징이었다.</p><p>(사람의 욕심은 역시 끝이 없는 것?)</p><p>사실 요즘 회사에서 점심시간에 Python을 활용하여 예측 모델에 대해 공부하고 있는데</p><p>왠지 Spotify 데이터를 활용해보고 싶었고 이전에 스크랩한Spotify TOP 200의 데이터 만으로는 분석을 위한 feature가 좀 부족하다고 판단이 되어</p><p>언제나 그렇듯 분석의 확장성을 위해 더 스크랩할 수 있는 부분이 무엇이 있을까 하다가</p><p>이전에 구글링하다가 발견한 R의 패키지 중 하나인 <strong>spotifyr</strong> 패키지에 대해 알아보기 시작했다.</p><h3>spotifyr</h3><p>Charlie Thompson 님 외 3분이 만들었고 아티스트, 트랙 등의 정보로 전반적인 음악 데이터를 추출할 수 있다.</p><p><a href="https://www.rcharlie.com/spotifyr/">R Wrapper for the &#39;Spotify&#39; Web API</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*hUz4of3bCQZvKDYYKF2nkg.jpeg" /></figure><h3><strong>get_track_audio_features</strong></h3><p>패키지의 49가지의 토픽 중에서 <strong>Spotify ID</strong>로 오디오 특징을 뽑아오는 <strong>get_track_audio_features</strong>를 사용해보기로 했다.</p><blockquote>Get audio feature information for a single track identified by its unique Spotify ID.</blockquote><p>아래와 같이 사용하면 되고</p><pre>get_track_audio_features(ids, authorization = get_spotify_access_token()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*URvB2DZc_mTldzAWi1L3wQ.jpeg" /></figure><p>이 코드를 돌리면 아래와 같은 데이터를 확인할 수 있다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcNEIMeo8-dIUUA57AxGRQ.jpeg" /></figure><blockquote>duration_ms, key, mode, time_signature, acousticness, danceability, energy, instrumentalness, liveness, loudness, speechiness, valence, tempo</blockquote><p>각 항목별 자세한 내용은 아래 링크에서 확인하면 된다.</p><p><a href="https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/">Get Audio Features for a Track | Spotify for Developers</a></p><h3>1. Spotify ID 리스트 추출</h3><p>먼저 Spotify TOP 200의 데이터에서 Spotify ID 리스트가 필요하다.</p><p>그 곡 들의 audio feature에 대한 정보를 추출할 것이기 때문이다.</p><p>URL 필드를 보면 가장 마지막 슬래시(‘/’) 뒤에 있는 부분이 각 트랙별 유니크한 Spotify ID 이다.</p><pre>URL : https://open.spotify.com/track/<strong><em>0nbXyq5TXYPCO7pr3N8S4I</em></strong></pre><p>먼저 Spotify TOP 200 데이터 프레임에서 Unique한 URL만 먼저 가져와 SPOTIFY_URL 리스트에 저장한다.</p><p>총 62600 개이다.</p><pre>SPOTIFY_URL &lt;- unique(SPOTIFY$URL)<br>length(SPOTIFY_URL) #62600</pre><p>이제 SPOTIFY_URL에 있는 모든 항목을 strsplit을 이용하여 ‘/’ 를 기준으로 자르고 반복문을 통해서 각 원소의 5번째 성분을 가져와 spotify_id 리스트에 저장한다.</p><p>다 가져왔는지 개수를 한번 다시 체크해본다.</p><p>(흠… 6시간 정도 걸렸는데 반복문이 최선인지는 좀 더 찾아봐야하는 부분이다)</p><pre>for (i in 1: length(SPOTIFY_URL)) {<br>  spotify_id[i] &lt;-  strsplit(as.character(SPOTIFY_URL),&#39;/&#39;)[[i]][5]<br>  print(i) #몇번째까지 되었는지 확인하기 위해 추가<br>  i = i + 1<br>}</pre><pre>length(spotify_id) #62600</pre><h3>2. Spotifyr Installation</h3><p>이제 <strong>spotifyr</strong>을 이용해 볼 차례이다.</p><p><strong>spotifyr</strong>패키지를 설치하고 로딩한다.</p><pre>install.packages(&#39;spotifyr&#39;)<br>library(spotifyr)</pre><h3>3. Authentication</h3><p>Web API를 이용하기 위해서는 먼저 인증이 필요하다.</p><p>아래 링크에서 계정을 만든다.</p><p><a href="https://developer.spotify.com/dashboard/applications">My Dashboard | Spotify for Developers</a></p><p>Client ID and Client Secret을 확인하고 이를 R에서 이용할 것이다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TV-M2kjwTutYiAUJHRIV5A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*kG3xUSHJvZMVq2Z0AEEM0g.jpeg" /></figure><p>위에서 확인한 Client ID and Client Secret을 아래 코드에 각각 입력한 뒤, 접근 토큰을 받으면 이제 Web API 사용이 가능하다!</p><pre>Sys.setenv(SPOTIFY_CLIENT_ID = &#39;&#39;)<br>Sys.setenv(SPOTIFY_CLIENT_SECRET = &#39;&#39;)<br>access_token &lt;- get_spotify_access_token()</pre><blockquote>인증이 완료되었다.</blockquote><h3>4. Usage</h3><p>이제 원하는 데이터를 뽑아볼 수 있다.</p><p><strong>spotifyr</strong> 패키지 중 <strong>get_track_audio_features</strong> 를 이용해 볼 차례이다.</p><p>마찬가지로,</p><p>반복문을 이용하여 각 Spotify ID를 변수로 넣어 각각 출력된 행들을 rbind 하여 데이터 프레임에 저장한다.</p><p>(돌리다보니 NULL로 추출되는 것들도 몇개 있어서 trycatch 문으로 오류잡는 코드도 추가했다.)</p><pre>for (i in 1:length(spotify_id)) {<br>  tryCatch({<br>  track_audio_features &lt;- get_track_audio_features(spotify_id[i])<br>  track_audio_features_full &lt;- rbind(track_audio_features_full,track_audio_features)<br>  print(i)<br>  i = i + 1<br>  }, error = function(e) message(paste(&quot;track_id does not seem to exist:&quot;, spotify_id[i])) )<br>}</pre><pre>view(track_audio_features_full)</pre><p>이로써,</p><blockquote>필요한 데이터셋 2개 모두 준비가 완료 되었다!</blockquote><blockquote><strong>1. Spotify TOP 200 (Web Scraping)</strong></blockquote><blockquote><strong>2. Audio Features by Track (Web API)</strong></blockquote><p>다음은</p><p><strong>R</strong>로 수집한 데이터를 가지고</p><p><strong>Python</strong>을 이용하여</p><p>데이터 모델링, 데이터 분석, 예측 분석 모델 적용 등을 해볼 것이다.</p><blockquote>드디어 Python !</blockquote><p>저의 커리어는 <a href="https://www.linkedin.com/in/dahee-lee-6b2497164/"><strong>Linkedin</strong></a><strong> </strong>에서</p><p>데이터 시각화는 <a href="https://public.tableau.com/profile/daheelee#!/?newProfile=&amp;activeTab=0"><strong>Tableau Public</strong></a><strong> </strong>에서</p><p>라이프스타일은 <a href="https://www.instagram.com/heehxh/"><strong>Instagram</strong></a><strong> </strong>에서 확인하실 수 있습니다:)</p><p>글과 관련하여 궁금한 점은 댓글 또는 daheelee1114@gmail.com 로 주세요!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2fd2a53421f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2020년과 프로젝트 시작]]></title>
            <link>https://daheelee1114.medium.com/2020%EB%85%84%EA%B3%BC-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EC%8B%9C%EC%9E%91-849d7722a2e5?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/849d7722a2e5</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[coachella]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[spotify]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Wed, 08 Jan 2020 12:40:18 GMT</pubDate>
            <atom:updated>2020-01-11T08:11:37.997Z</atom:updated>
            <content:encoded><![CDATA[<h3>2020년과 프로젝트 시작 : Spotify Web Scraping in R</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h_72I05O1nx3jBwq" /><figcaption>Photo by <a href="https://unsplash.com/@saltnstreets?utm_source=medium&amp;utm_medium=referral">Alesia Kazantceva</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>2020년을 새롭게 시작하기 위해서 2019년 12월 말부터 시작하게 된 개인 프로젝트에 대한 기록을 해보고자 한다. #newyearnewme</p><h3>프로젝트를 시작한 이유</h3><p>2020년 4월 드디어 Coachella Music Festival에 간다.</p><h4>무슨 상관?</h4><p>20살 뮤직 페스티벌에 빠지기 시작했을 때 부터 20대에 꼭<a href="https://www.coachella.com/"> Coachella Music Festival</a>에 가겠다! 고 다짐을 했었는데 정말 딱 29살에 간!다!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8Z134n4h3uSlrMkV" /><figcaption>Photo by <a href="https://unsplash.com/@andrewruiz?utm_source=medium&amp;utm_medium=referral">Andrew Ruiz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://www.coachella.com/">Coachella Valley Music and Arts Festival</a></p><p>2019년 12월.</p><p>티켓은 사놓았지만 라인업은 아직 공개가 되지 않은 시점이었다.</p><p>(아직도 TMI)</p><p>한두푼 하는 티켓 값도 아닐 뿐더러 무작정 티켓은 샀지만 그래도 라인업은 너무 너무 궁금하니까 역대 라인업을 쭉 보다가</p><p>흠.. 내가 예측할 수 있지 않을까?하는 생각이 들었다.</p><h4>어떻게?</h4><p><strong>Spotify</strong>의 스트리밍 데이터를 이용해보기로 했다.</p><p>Coachella Music Festival은 미국에서 열리는 행사이고 미국에서 가장 많은 이용자 수를 갖고 있는 음악 스트리밍 앱은 <strong>Spotify</strong>이고 아티스트의 스트리밍 데이터를 분석해보면 라인업을 알 수 있을 것만 같았다.</p><p><a href="https://www.businessinsider.com/best-music-streaming-service-subscription">The best music streaming services you can subscribe to</a></p><h4>데이터는?</h4><p>Spotify Chart TOP 200에 대한 각 국가별, 날짜별 스트리밍을 확인할 수 있는 웹사이트가 있다.</p><p><a href="https://spotifycharts.com/regional">Spotify Charts</a></p><p>아래 이미지처럼 필터에 따라서 국가별, 날짜별 데이터를 CSV 파일로 다운로드 받을 수 있는데</p><p>흠…</p><p>2020년 1월 6일 글로벌 TOP 200의 스트리밍만 궁금하다면 바로 해당 국가, 해당 일자의 데이터를 CSV로 받으면 되겠지만 나는 미국의 총 3개년(2017–2019) 데이터 전체가 필요했고 일일이 필터를 바꿔가며1095번(365*3) DOWNLAD TO CSV를 누르고 싶지 않았다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wGMxnWR5IBhILfdCvXAtiQ.jpeg" /></figure><h4>그럼 진짜 어떻게?</h4><p>웹 스크래핑을 해보기로 했다.</p><p>예전에 R을 이용해 멜론 웹 스크래핑 했을 때의 기억을 더듬어서 진행해보았다.</p><h3>Spotify Web Scraping</h3><h4>1. 리서치</h4><p>일단 나와 같은 경우가 많겠지 싶어서 예시를 찾기 위해 열심히 구글링을 시작했다. 당연히 있다. 아래 링크는 RPubs에 있는것으로 데이터 스크랩부터 시각화까지에 해당하는 내용이다. 먼저 이 링크에서 전반적인 내용을 훑어보았다.</p><p><a href="https://rpubs.com/argdata/web_scraping">RPubs</a></p><p><strong>라이브러리</strong></p><p>필요한 라이브러리는 아래와 같다.</p><blockquote><a href="https://www.rdocumentation.org/packages/rvest/versions/0.3.5">rvest</a></blockquote><blockquote><a href="https://www.rdocumentation.org/packages/tidyverse/versions/1.3.0">tidyverse</a></blockquote><blockquote><a href="https://www.rdocumentation.org/packages/magrittr/versions/1.5">magrittr</a></blockquote><p><strong>URL 구조</strong></p><p><a href="https://spotifycharts.com/regional">spotifycharts.com</a> 의 URL은 국가별, 날짜별 필터에 따라 CountryCode, YYYY-MM-DD 부분이 바뀐다.</p><pre>https://spotifycharts.com/regional/<strong><em>CountryCode</em></strong>/daily/<strong><em>YYYY-MM-DD</em></strong></pre><p>예를 들어</p><blockquote>2020년 1월 6일 영국의 URL <a href="https://spotifycharts.com/regional/gb/daily/2020-01-06">https://spotifycharts.com/regional/gb/daily/2020-01-06</a></blockquote><blockquote>2020년 1월 7일 미국의 URL <a href="https://spotifycharts.com/regional/us/daily/2020-01-07">https://spotifycharts.com/regional/us/daily/2020-01-07</a></blockquote><p>하지만 RPubs 링크의 글은 url이 이미 아래와 같이 us로 고정되어 시작한다. 즉, 미국의 날짜별 스트리밍 데이터를 스크랩 하는 코드이다.</p><pre>url &lt;- &quot;https://spotifycharts.com/regional/<strong>us</strong>/daily/&quot;</pre><p>하지만 나는 이왕하는거 + 분석의 확장을 위하여 국가별, 날짜별 필터까지 적용된 코드를 직접 짜보기로 했다.</p><h4>2. 코딩</h4><ol><li>필요한 패키지를 로딩한다.</li></ol><pre>library(rvest)<br>library(tidyverse) <br>library(magrittr) </pre><p>2. URL에 들어갈 국가와 날짜를 각각 countries, timevalues 변수에 넣는다.</p><blockquote><em>countries : 국가는 총 65개국</em></blockquote><blockquote><em>timevalues : 날짜는 2017–01–01 부터 2019-12-31일 까지이다.</em></blockquote><pre>countries &lt;- c(‘global’,’us’,’gb’,”ar”,”at”,”au”,”be”,”bg”,”bo”,”br”,”ca”,”ch”,”cl”,”co”,”cr”,”cy”,”cz”,”de”,“dk”,”do”,”ec”,”ee”,”es”,”fi”,”fr”,”gr”,”gt”,”hk”,”hn”,”hu”,”id”,”ie”,”il”,”in”,”is”,”it”,”jp”,“lt”,”lu”,”lv”,”mc”,”mt”,”mx”,”my”,”ni”,”nl”,”no”,”nz”,”pa”,”pe”,”ph”,”pl”,”pt”,”py”,”ro”,”se”,“sg”,”sk”,”sv”,”th”,”tr”,”tw”,”uy”,”vn”,”za”)</pre><pre>timevalues &lt;- <br>seq(as.Date(&quot;2017/01/01&quot;), as.Date(&quot;2019/12/31&quot;) , by = &quot;day&quot;)</pre><p>3. 필요한 Vector, Data Frame를 만든다.</p><blockquote><em>url_2 : 국가 코드까지 들어간 URL을 담을 Vector</em></blockquote><blockquote><em>full_url : 국가 코드와 날짜까지 들어간 URL을 담을 Vector</em></blockquote><blockquote><em>spotify_scrapped : URL별로 스크랩된 데이터를 담을 Data Frame</em></blockquote><pre>url_2 &lt;- vector( mode = ‘character’,length(countries))</pre><pre>full_url &lt;- vector( mode = ‘character’,length(timevalues) * length(countries))</pre><pre>spotify_scrapped &lt;- data.frame(“Rank”, “Track”, “Artist”, “Streams”,”Country”, “Date”,”URL”)</pre><pre>names(spotify_scrapped) &lt;- c(“Rank”, “Track”, “Artist”, “Streams”,”Country”, “Date”,”URL”)</pre><pre>spotify_scrapped &lt;- spotify_scrapped[-1,]</pre><p>4. URL에서 필요한 데이터를 스크랩하는 SpotifyScrape 함수를 만든다.</p><p>rank, track, artist, streams, country, dates, url에 대한 데이터를 가져오고</p><p>컬럼으로 묶은 후 Rank, Track, Artist, Streams, Country, Date, URL로 필드명을 지정한 뒤 tibble 형태의 chart 를 만든다.</p><pre>SpotifyScrape &lt;- function(x){  <br>  page &lt;- x  <br>  rank &lt;- page %&gt;% read_html() %&gt;% html_nodes(&#39;.chart-table-position&#39;) %&gt;% html_text() %&gt;% as.data.frame()  <br>  track &lt;- page %&gt;% read_html() %&gt;% html_nodes(&#39;strong&#39;) %&gt;% html_text() %&gt;% as.data.frame()  <br>  artist &lt;- page %&gt;% read_html() %&gt;% html_nodes(&#39;.chart-table-track span&#39;) %&gt;% html_text() %&gt;% as.data.frame()  <br>  streams &lt;- page %&gt;% read_html() %&gt;% html_nodes(&#39;td.chart-table-streams&#39;) %&gt;% html_text() %&gt;% as.data.frame()  <br>  country &lt;- page %&gt;% read_html() %&gt;% html_node(&#39;.responsive-select-value&#39;) %&gt;% html_text() %&gt;% as.data.frame()<br>  dates &lt;- page %&gt;% read_html() %&gt;% html_nodes(&#39;.responsive-select~ .responsive-select+ .responsive-select .responsive-select-value&#39;) %&gt;% html_text() %&gt;% as.data.frame() <br>  url &lt;- page %&gt;% read_html() %&gt;% html_nodes(&#39;.chart-table-image&#39;)  %&gt;% html_nodes(&#39;a&#39;) %&gt;% html_attr(&#39;href&#39;) %&gt;% as.data.frame() <br> #combine, name, and make it a tibble  <br>  chart &lt;- cbind(rank, track, artist, streams, country, dates, url)  <br>  names(chart) &lt;- c(&quot;Rank&quot;, &quot;Track&quot;, &quot;Artist&quot;, &quot;Streams&quot;,&quot;Country&quot;, &quot;Date&quot;,&quot;URL&quot;)  <br>  chart &lt;- as.tibble(chart)  <br>  return(chart) }</pre><p>5. 웹 스크래핑을 시작한다.</p><p>이 부분에 대한 내용은 잘 찾아볼 수가 없어서 직접 코딩하느라 나름의 챌린지였고 제일 뿌듯한 부분이기도 하다 :)</p><p>for 반복문을 이용하여 url_2와 full_url을 만들고 위에서 만든 SpotifyScrape 함수에 full_url을 넣어 spotify에 데이터를 임시 저장하고 spotify_scrapped에 모든 데이터를 축적한다.</p><p>혹시 해당 국가, 해당 일자의 URL이 없을 경우는 tryCatch를 이용해 에러 메세지를 표시하고 다음 반복문으로 넘어간다.</p><pre>for (i in 1: length(countries)) {<br>    url_2[i] &lt;-  paste0 (&quot;<a href="https://spotifycharts.com/regional/">https://spotifycharts.com/regional/</a>&quot;,countries[i],&#39;/&#39;,&#39;daily&#39;,&#39;/&#39;)<br>    #print(url_2[i])<br>      for (j in 1: length(timevalues) ) {<br>        full_url[j] &lt;- paste0(url_2[i],timevalues[j])<br>        #print(full_url[j])<br>        tryCatch (<br>          {spotify &lt;- map_df(full_url[j] , SpotifyScrape)<br>          spotify_scrapped &lt;- rbind(spotify_scrapped, spotify)<br>          if (j &gt; length(timevalues) ) {<br>            j = 1<br>          } else {<br>            j = j + 1 <br>          }<br>          }, error = function(e) message(paste(&quot;URL does not seem to exist:&quot;, full_url[j])) <br>        )<br>      }<br>    i = i + 1 <br>  }</pre><h4>4. 데이터 필터</h4><p>분석의 확장을 위하여 모든 국가의 데이터를 스크랩 했지만 일단 미국의 데이터만 필요하니 Country가 United States인 행만 필터하여 spotify_scrapped_us에 저장한다.</p><pre>spotify_scrapped_us &lt;- filter(spotify_scrapped, Country == &#39;United States&#39;)</pre><h4>5. 데이터 확인</h4><p>데이터를 확인해본다. 총 218200행이다.</p><pre>view(spotify_scrapped_us)<br>dim(spotify_scrapped_us)<br>[1] 218200      7</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31PPw4uS67U70fYUHrW8YA.jpeg" /></figure><h4>6. 데이터 정제</h4><p>위에 스크린샷을 보면 수정해야할 부분들이 있다.</p><blockquote><em>Artist : by 지우기</em></blockquote><blockquote><em>Streams : 컴마 지우고 집계를 위해 문자형식을 숫자형식으로 바꾸기</em></blockquote><blockquote><em>Date : 연/월/일 트렌드를 보기 위해 문자형식을날짜형식으로 바꾸기</em></blockquote><p>수정 후 테이블은 다시 한번 확인해본다.</p><pre>spotify_scrapped_us %&lt;&gt;% mutate(Artist = gsub(&quot;by &quot;, &quot;&quot;, Artist),  Streams = gsub(&quot;,&quot;, &quot;&quot;, Streams),  Streams = as.numeric(Streams),  Date = as.Date(spotify_scrapped_us$Date, &quot;%m/%d/%Y&quot;))</pre><pre>view(spotify_scrapped_us)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ka8B_6WlLsghbqmY-EsTAQ.jpeg" /></figure><h4>7. 데이터 추출</h4><p>정리가 다 되었으니 csv파일로 로컬에 추출한다.</p><pre>write.csv(spotify_scrapped_us,&#39;/Users/dahee/Desktop/Project_dahee/spotify/spotify_us.csv&#39;)</pre><blockquote>US의 3개년 Spotify Streaming 데이터 스크랩 완료!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rv2LSora5Fq9LPDc" /><figcaption>Photo by <a href="https://unsplash.com/@szolkin?utm_source=medium&amp;utm_medium=referral">Sergey Zolkin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>다음 글에서는 아래 내용들에 대해 기록해보도록 하겠다.</p><blockquote><em>Tableau를 활용한 데이터 시각화</em></blockquote><blockquote><em>Coachella 라인업 데이터 스크랩</em></blockquote><blockquote><em>Spotify Streaming 과 Coachella 라인업과의 상관 분석 및 예측 분석</em></blockquote><p>그나저나 프로젝트를 진행하던 중에 2020년 1월 3일에 라인업이 발표가 났다. 예측해보려고 했으나 답지라고 생각하고 한번 풀어나가야겠다.</p><p>그나저나 라인업 대박 ㅠㅠ 4월까지 열심히 존버하며 기다려보아야지!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-fSgLPFjxfNlB0AI4dmfA.jpeg" /></figure><p>(혹시 궁금한 분들을 위해서 Coachella Music Festival를 준비하는 과정도 다뤄볼까 고민이다)</p><p>저의 커리어는 <a href="https://www.linkedin.com/in/dahee-lee-6b2497164/"><strong>Linkedin</strong></a><strong> </strong>에서</p><p>데이터 시각화는 <a href="https://public.tableau.com/profile/daheelee#!/?newProfile=&amp;activeTab=0"><strong>Tableau Public</strong></a><strong> </strong>에서</p><p>라이프스타일은 <a href="https://www.instagram.com/heehxh/"><strong>Instagram</strong></a><strong> </strong>에서 확인하실 수 있습니다:)</p><p>글과 관련하여 궁금한 점은 댓글 또는 daheelee1114@gmail.com 로 주세요!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=849d7722a2e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to show a map within X meters of X location in Tableau]]></title>
            <link>https://medium.com/analytics-vidhya/how-to-show-a-map-within-x-meters-of-x-location-in-tableau-525a1243978e?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/525a1243978e</guid>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[las-vegas]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[태블로]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Wed, 04 Dec 2019 03:55:14 GMT</pubDate>
            <atom:updated>2020-01-10T05:04:37.890Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been using Tableau since 2017 and Tableau has been updated a lot with awesome features.</p><h3>Workout Wednesday</h3><p>Workout Wednesday is the one of the websites that I’m looking to build my skills up in Tableau.</p><blockquote>A weekly challenge to re-create a data-driven visualization.</blockquote><p><a href="http://www.workout-wednesday.com/">Workout Wednesday</a></p><p>I was looking for a feature to show a map within X meters of X location to apply on the project that I’m currently working on.</p><p>And below is the thing that I’ve been exactly looking for so, let me share some features that I’ve learnt from this workout.</p><p><strong>#WorkoutWednesday2019</strong></p><h3>Week 43: Show me all the casinos within X miles of X casino by meters</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*mH10rluV6GWZdp5BATnpbg.gif" /><figcaption>A mobile friendly dashboard to map all the casinos around the selected casino</figcaption></figure><p><a href="http://www.workout-wednesday.com/week-43-show-me-all-the-casinos-within-x-miles-of-x-casino-by-metres/">Week 43: Show me all the casinos within X miles of X casino by metres</a></p><h3><strong>Features</strong></h3><blockquote><strong>MakePoint</strong> converts data from latitude and longitude columns into spatial objects.</blockquote><blockquote><strong>Distance</strong> returns distance measurement between two points in a specified unit which are meters, kilometers, miles and feet.</blockquote><blockquote><strong>Parameter Action </strong><em>to let your audience change a parameter value through</em><strong><em> </em></strong><em>direct interaction with a viz, such as clicking or selecting a mark.</em></blockquote><h3>Data</h3><p>Las Vegas Casino Data from <a href="https://www.worldcasinodirectory.com/nevada/las-vegas/map">WorldCasinoDirectory</a>. There are only 4 columns.</p><blockquote>Column 1 : <strong>Name</strong></blockquote><blockquote>Column 2: <strong>Address</strong></blockquote><blockquote>Column 3: <strong>Latitude</strong></blockquote><blockquote>Column 4: <strong>Longitude</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*TGMQmDiCmc_AdCR3yqEeuQ.png" /></figure><p>You can download this data from link below.</p><p><a href="https://data.world/missdataviz/las-vegas-casinos">Las Vegas Casinos - dataset by missdataviz</a></p><h3>Parameters</h3><p>We need to create 2 parameters that can be selected by user.</p><blockquote>parameter 1 : Select a Casino</blockquote><p><strong>Select a Casino</strong> is to select a mark on the map and update selected casino.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J7tJxPXC0Q7_X3JqITOhJA.png" /></figure><blockquote>parameter 2 : Miles Away</blockquote><p><strong>Miles Away </strong>is to input custom number of miles to show selected casino and all others within mileage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xT4Q526nBBDmEvAHgARnQA.png" /></figure><h3>Calculated Fields</h3><p>We need to create 7 calculated fields.</p><blockquote>Calculated Field 1 : Selected Latitude</blockquote><p><strong>Selected Latitude </strong>is latitude of the casino which is selected by user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g8NQFklgdBqYePA664CWsA.png" /></figure><blockquote>Calculated Field 2 : Selected Longitude</blockquote><p><strong>Selected Longitude </strong>is Longitude of the casino which is selected by user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Poq-H3O4i_7BJj7VzxLqzg.png" /></figure><blockquote>Calculated Field 3 : MakePoint Start</blockquote><p><strong>MakePoint Start</strong> is a spatial objects from <strong>Selected Latitude</strong> and <strong>Selected Longitude</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9WBoBMcq_d41i_04wzM9Q.png" /></figure><blockquote>Calculated Field 4 : MakePoint Casinos</blockquote><p><strong>MakePoint Casinos</strong> is a spatial objects of all other casinos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9jCGawots8Q5XETQfSezKA.png" /></figure><blockquote>Calculated Field 5 : Distance Miles</blockquote><p><strong>Distance Miles</strong> to return distance measurement between <strong>MakePoint Start </strong>and <strong>MakePoint Casinos</strong> in miles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nVH0u3A6w1egjFUBZ-y_Wg.png" /></figure><blockquote>Calculated Field 6 : Selected Casino</blockquote><p><strong>Selected Casino </strong>is to highlight and shape a value from <strong>Select a Casino</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XxYIb-NQFUKJR68wp7kl7w.png" /></figure><blockquote>Calculated Field 7: Miles Filter</blockquote><p><strong>Miles Filter</strong> is to show only selected casino and all others within mileage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTDGWvvRVfppGs5XehFqRQ.png" /></figure><h3>Parameter Action</h3><p>After creating a dashboard, the last thing you have to do is to create a parameter action.</p><p>Specify the target parameter and a source field which can be a <strong>Select a Casino </strong>from parameters and <strong>name</strong> from source fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-TFYv1HIDCzGsYqIOck5wQ.png" /></figure><p><a href="https://help.tableau.com/current/pro/desktop/en-us/actions_parameters.htm">Parameter Actions</a></p><blockquote><strong>Here is my shot!</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*7m5JGlmcI7gVw9HEBtflaA.png" /></figure><p>You can check my data visualization here more!</p><p><a href="https://public.tableau.com/profile/daheelee#!/">Tableau Public</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=525a1243978e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/how-to-show-a-map-within-x-meters-of-x-location-in-tableau-525a1243978e">How to show a map within X meters of X location in Tableau</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau Desktop Specialist Certification : My Experience]]></title>
            <link>https://daheelee1114.medium.com/tableau-desktop-specialist-certification-f74f93bda36c?source=rss-b0e97ff01aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f74f93bda36c</guid>
            <category><![CDATA[tableau-desktop]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[태블로]]></category>
            <category><![CDATA[experience]]></category>
            <dc:creator><![CDATA[Dahee Lee]]></dc:creator>
            <pubDate>Wed, 13 Nov 2019 03:17:00 GMT</pubDate>
            <atom:updated>2019-11-26T13:42:58.582Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tableau Desktop Specialist Certification : My Experience</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v47VzikH_9a_IgAY" /><figcaption>Photo by <a href="https://unsplash.com/@campaign_creators?utm_source=medium&amp;utm_medium=referral">Campaign Creators</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Tableau Desktop Specialist 자격증을 취득했다.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*PXpbTsdGddUhwI3IIti4IQ.png" /></figure><blockquote>Tableau는 전 세계적으로 유명한 데이터 시각화 툴이다.</blockquote><p><a href="https://www.tableau.com/">Business Intelligence and Analytics Software | Tableau</a></p><p>하지만 그에 비해 아직 한국에는 Tableau 자격증 취득자가 많이 없다.</p><p>Tableau 웹사이트에서 자격증 취득자 리스트를 확인할 수 있는데</p><p>Tableau Desktop Specialist의 경우 디렉토리에 노출된 리스트는 14명에 불과하다. (2019년 11월 26일 기준)</p><p><a href="https://www.tableau.com/support/certification/directory">Certification Directory</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*colp6Xuk670B5ycX0VRh6w.png" /><figcaption>Certification Directory</figcaption></figure><p>시험을 응시한 사람도 적고 그렇다보니 한글로 된 후기도 많이 없고 그래서 시험에 대한 경험을 공유하면 좋을 것 같다는 생각이 들었다.</p><h3><strong>시험 준비</strong></h3><ol><li><strong>시험 등록</strong></li></ol><p>Tableau 시험은 <a href="https://tableau.lcsexams.com/">Loyalist Exam Services (LES)</a>를 통해 진행된다. 해당 링크로 접속 후 로그인을 하면 아래와 같은 화면에서 시험을 신청할 수 있고 가격은 $100 이다. 시험 일정도 정해야하는데 시간대는 1시간 단위로 있어서 원하는 시간을 선택하면 된다. 그리고 24시간 전까지는 리스케쥴링이 가능하다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-7YBE5Ki9knFWt1ADFbWA.png" /></figure><p><strong>2. 시험 공부</strong></p><p>아래 4가지 링크를 참고하여 시험을 준비했다. Tableau Desktop Specialist 시험은 Tableau 전반적인 개념과 기초적인 실습 문제 위주로 출제되어서 개념을 확실히 이해하는 시간을 많이 가졌다. 이정도만 보고 공부해도 시험 통과는 무난하게 할 수 있을 것 같다.</p><blockquote><a href="https://mkt.tableau.com/files/DesktopSpecialist_ExamGuide.pdf"><em>Desktop Specialist Exam Guide</em></a><em> : Tableau에서 제공하는 예시 문제이다.</em></blockquote><blockquote><a href="https://www.tableau.com/learn/training"><em>Free Training Videos</em></a><em> : Tableau에서 제공하는 무료 강의이다.</em></blockquote><blockquote><a href="https://learningtableau.com/"><em>Learning Tableau</em></a><em> : 연습 문제를 풀어볼 수 있다.</em></blockquote><blockquote><a href="https://www.youtube.com/channel/UC3kP408LyGGvyHEIkugk9RA"><em>PLANIT DATAV </em></a><em>: 플랜잇 유튜브 채널로 개념을 익힐 수 있다.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kPn3LUxRE5iTB2SSqNQzbQ.jpeg" /><figcaption>공부 현장</figcaption></figure><h3>시험 응시</h3><ol><li>시험 셋업</li></ol><p>여권!! 확인과 함께 테이블과 시험 보는 공간을 감독관에게 보여주고 시험을 응시할 수 있는 환경인지 테스트하기 위해 속도 체크 (<a href="https://cloud.skytap.com/connectivity">connectivity checker</a>, <a href="http://speedtest.skytap.com/">connection speed test</a>)를 한다. 모든 것이 완벽하면 그 때 시험이 시작되는데 이 과정은 대략 30분 내외여서 감독관과 많은 확인을 하다 보면 어느새 긴장이 다 풀리는 것 같다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kSPdvsIhgmA_yw_VQmvRHw.jpeg" /><figcaption>시험 현장</figcaption></figure><blockquote><em>여권 확인</em></blockquote><blockquote><em>시험 공간 360도 확인</em></blockquote><blockquote><em>책상 확인(물과 초콜렛이 있었지만 괜찮았다)</em></blockquote><blockquote><em>인터넷 속도 확인</em></blockquote><blockquote><em>시험 관련 없는 application 종료 확인</em></blockquote><blockquote><em>랩탑 카메라 위치 확인</em></blockquote><p>2. 시험 진행</p><p>시험 진행 관련해서는 아래 키워드를 참고하면 된다.</p><blockquote><strong>60 Minutes / 30 Questions </strong>(1문제당 2분 정도 풀면 된다)</blockquote><blockquote><strong>MCQ and hands-on</strong> (첫문제가 개념문제일거라는 크나큰 오해와 함께 시험을 시작했는데 실습 문제였다. 당황하지마시길…)</blockquote><blockquote><strong>Flag</strong> (모르는 문제는 과감하게 깃발 꼽고 넘어가고 나중에 풀었다)</blockquote><blockquote><strong>Google</strong> (모르는 문제는 바로 구글링했다)</blockquote><blockquote><strong>Virtual desktop </strong>(윈도우 가상머신에서 진행된다)</blockquote><h3>시험 끝</h3><p>60분 시험 제출 후 시험 경험과 관련된 설문조사를 하고 아주 바로 결과를 확인할 수 있다.</p><blockquote>시험 통과 하면 감독관이</blockquote><blockquote>Congratulations! 하고 축하해준다.</blockquote><p>퇴근 후 밤 10시에 시험 보고 다 끝나고 정리하니 12시 였다. 너무 늦은 밤이라 피곤했지만 그래도 통과하니 기분이 좋았다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4F3UjWmVh0mQYqPgIInrw.jpeg" /><figcaption>시험 통과 후 택시 기다리는 현장</figcaption></figure><p>Desktop Specialist 시험 보고 삘 받아서 그 다음주에 바로 Desktop Certified Associate도 바로 응시했는데 이것도 후기를 작성해봐야겠다.</p><blockquote><a href="https://public.tableau.com/profile/daheelee#!/">Tableau Public Link</a></blockquote><blockquote>여기에서 저의 data visualization을 확인할 수 있습니다 !</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f74f93bda36c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>