[성동2기 전Z전능 데이터 분석가] DAY 42
- cool_stuff 판매량 지도로 나타내기
- SNS 전환률 확인하기
- 금요일에 왜 주문량이 더 적을까?
cool_stuff 판매량 지도로 나타내기
지역별로 Cool_sfuff 판매량 확인
select
ocd.customer_state,
count(*) as order_count
from olist_orders_dataset ood
inner join olist_order_items_dataset ooid
on ood.order_id = ooid.order_id
inner join olist_products_dataset opd
on ooid.product_id = opd.product_id
inner join product_category_name_translation pcnt
on opd.product_category_name = pcnt.product_category_name
inner join olist_customers_dataset ocd
on ocd.customer_id =ood.customer_id
where pcnt.product_category_name = 'cool_stuff'
group by ocd.customer_state
order by ocd.customer_state ;
State | State | coolstuff주문량 | 전체상품주문량 | 전체상품대비coolstuff주문비율 |
AC | Acre | 1 | 90 | 1.1% |
AL | Alagoas | 16 | 440 | 3.6% |
AM | Amazonas | 4 | 163 | 2.5% |
AP | Amapá | 2 | 82 | 2.4% |
BA | Bahia | 146 | 3738 | 3.9% |
CE | Ceará | 51 | 1460 | 3.5% |
DF | Distrito Federal | 80 | 2373 | 3.4% |
적도에 가까울 수록 coolstuff 주문율이 높은지 검증하기 위해 state별로 위도 출력(파이썬 이용)
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="Brasil", timeout=None)
def geocoding(address):
geolocoder = Nominatim(user_agent = 'Brasil', timeout=None)
geo = geolocoder.geocode(address)
crd = {"lat": str(geo.latitude), "lng": str(geo.longitude)}
return crd
for i in range(len(df)):
coordinates = geocoding(df.loc[i, "state"])
df.loc[i, "Latitude"] = coordinates["lat"]
df.loc[i, "Longitude"] = coordinates["lng"]
df
(Acre의 경우 위도와 경도가 이상하여 구글지도에서 위도와 경도값을 찾아 따로 행을 수정했다)
상관관계 분석 및 산점도
관계가 없다는 것을 알 수 있었다....................
진행하다보니 우기에 한정해서 진행하지 않았는데 해당 지점을 반영한다면 또 다른 결과가 나올 수 있을 것 같아 내일 진행 예정
SNS 전환률 확인하기
시간별로 SNS 주문량은 이미 확인한 상태
leftjoin 이용해서 전환율이 얼마나 되는지 확인 가능하다
유입경로 | 유입된 사람 수 | 실제 주문수 | 실제 주문율 |
social | |||
direct |
# SNS 전환률 확인
select
omql.origin,
count(*) as inflow_count,
count(ocdd.mql_id) as closed_deal,
count(ocdd.mql_id)/count(*)*100 as closed_deal_rate
from olist_marketing_qualified_leads_dataset omql
left join olist_closed_deals_dataset ocdd
on ocdd.mql_id = omql.mql_id
group by omql.origin
order by closed_deal_rate desc;
SNS의 전환률은 약 5.6%이며 구매로 이어진 수의 비율로는 4위였다.
전환률이 그렇게 높지는 않지만, SNS를 통해 유입된 사람의 수가 많기 때문에 구매로 이어진 사람의 수 또한 높았다.
SNS에서 광고를 한 것은 paid_search 안에 들어갈 것이므로, 실제로는 SNS를 통해서 들어와 구매한 사람이 더 높을 것으로 예상할 수 있다.
unknown이 어디서 온 것일지 찾기 위해서 다른 항목과 상관분석을 진행했고 상관관계가 0.95에 가깝게 나왔으나, 이것만으로 이게 영향을 줬다고 보기에는 어렵다.
현재 자료를 통해서는 unknown의 출처를 알기 어렵기 때문에 고객 데이터를 추적할 수 있는 추가적인 방안이 필요할 것으로 생각된다.
상관분석 진행
내일 진행할 것
여름에 주문량 확인
금요일에 왜 주문량이 더 적을까?
데이터프레임 설명 작성
밤 시간대도 확인