철솜_STUDY
ECC 프로젝트) 1차 회의용 _ 데이터 분석 내용 본문
1/25 진행 회의
주제
- 처음에 생각했던 거는 각 쇼핑몰 별 상품 리뷰 텍스트 분석을 해서 평점을 예측하는 프로젝트였는데 세부적으로 확인하니까 각 쇼핑몰 앱에 대한 리뷰 + 평점이더라고요... 그래서 처음 생각한 주제에 맞는 데이터 세트를 캐글에서 찾아봤는데 너무 예전 데이터 셋이거나 부적절해 보여서 지금 데이터 셋으로 진행하는 게 나을 거 같다고 생각했습니다..! 혹시 비슷한 주제로 다른 데이터 세트를 사용하고 싶으시면 더 찾아보고 진행해도 괜찮을 것 같아요..! 꼼꼼하게 확인하지 못 해서 죄송합니다 ㅠ
- 칼럼에 대한 설명
- reviewId : 이 칼럼은 없애도 될 것 같습니다. 어차피 행 구분용 칼럼이어서 큰 의미도 없고, 문자열이어서 처리도 번거로울 것 같아요!
- content : 이 칼럼은 실제 리뷰에 대한 내용이니 칼럼 명을 review로 바꿔도 될 것 같습니다!
- score : 이 부분이 저희 타겟 값이니까 맨 마지막 칼럼으로 바꿔놔도 될 거 같습니다.
- thumbsUpCount : 이 칼럼은 해당 리뷰에 대해 얼마나 많은 사람들이 동의하고 있는지를 나타내는 칼럼이기도 하고, 숫자형이어서 굳이 없앨 필요는 없어 보입니다.
- replyContent : 이 칼럼은 굳이 필요하지는 않을 것 같은데 다른 분들의 의견이 궁금합니다!
- repliedAt : 이 칼럼은 굳이 필요하지는 않을 것 같은데 다른 분들의 의견이 궁금합니다!
- appName : 밑에서 설명을 할텐데 각 지금 11개 쇼핑앱에 대한 리뷰 데이터 셋이 있는데, 각 크기가 다 꽤 큰 상태다보니, 각 데이터에서 특정 갯수만큼 랜덤추출하고 추출 데이터 셋을 합치게 되면 이 칼럼이 유의미해질 것 같습니다. 혹은 현재 11개의 데이터 세트 중에 자료가 5만개가 넘는 세트가 꽤 있어서 그 중 하나만 골라 사용할 경우에 appName 칼럼은 필요가 없을 것 같아요!
- 위 칼럼 설명에서 주요하다고 판단한 content, score, thumbsUpCount에 대해서만 일단 칼럼 분석을 진행했습니다!
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
alibaba = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Amazon shopping.csv")
aliexpress = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Aliexpress.csv")
amazon = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Amazon shopping.csv")
daraz = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Daraz Online Shopping App.csv")
Flip = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Flipkart.csv")
lazada = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Lazada.csv")
meesho = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Meesho.csv")
myntra = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Myntra.csv")
shein = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Shein.csv")
snap = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Snapdeal.csv")
walmart = pd.read_csv("C:\\Users\\rud92\\Machine_learning_Project\\Walmart.csv")
alibaba.head(3)
alibaba.shape
print("{0} 형태 : {1}".format("alibaba", alibaba.shape))
print("{0} 형태 : {1}".format("aliexpress", aliexpress.shape))
print("{0} 형태 : {1}".format("amazon", amazon.shape))
print("{0} 형태 : {1}".format("daraz", daraz.shape))
print("{0} 형태 : {1}".format("Flip", Flip.shape))
print("{0} 형태 : {1}".format("lazada", lazada.shape))
print("{0} 형태 : {1}".format("meesho", meesho.shape))
print("{0} 형태 : {1}".format("myntra", myntra.shape))
print("{0} 형태 : {1}".format("shein", shein.shape))
print("{0} 형태 : {1}".format("snap", snap.shape))
print("{0} 형태 : {1}".format("walmart", walmart.shape))
alibaba 형태 : (99000, 8)
aliexpress 형태 : (126000, 8)
amazon 형태 : (99000, 8)
daraz 형태 : (54000, 8)
Flip 형태 : (18000, 8)
lazada 형태 : (54000, 8)
meesho 형태 : (36000, 8)
myntra 형태 : (36000, 8)
shein 형태 : (40500, 8)
snap 형태 : (27000, 8)
walmart 형태 : (45000, 8)
칼럼 별 결측치 여부 확인
- 일단 NaN이 존재하는지를 중점적으로 확인했습니다.
- 추가적으로 문자열 칼럼의 경우 문자열의 길이 또한 확인했습니다. 너무 짧은 리뷰가 있는지를 확인하기 위해서 진행했습니다!
print("{0} 결측치 여부 \n: {1}\n\n".format("alibaba", alibaba.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("aliexpress", aliexpress.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("amazon", amazon.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("daraz", daraz.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("Flip", Flip.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("lazada", lazada.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("meesho", meesho.isnull().sum()))
print("{0} 결측치 여부 \n\n: {1}\n\n".format("myntra", myntra.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("shein", shein.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("snap", snap.isnull().sum()))
print("{0} 결측치 여부 \n: {1}\n\n".format("walmart", walmart.isnull().sum()))
alibaba 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 98998
repliedAt 98998
appName 0
dtype: int64
aliexpress 결측치 여부
: reviewId 0
content 1
score 0
thumbsUpCount 0
at 0
replyContent 124564
repliedAt 124564
appName 0
dtype: int64
amazon 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 98998
repliedAt 98998
appName 0
dtype: int64
daraz 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 33828
repliedAt 33828
appName 0
dtype: int64
Flip 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 13209
repliedAt 13209
appName 0
dtype: int64
lazada 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 31060
repliedAt 31060
appName 0
dtype: int64
meesho 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 1125
repliedAt 1125
appName 0
dtype: int64
myntra 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 21480
repliedAt 21480
appName 0
dtype: int64
shein 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 29290
repliedAt 29290
appName 0
dtype: int64
snap 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 608
repliedAt 608
appName 0
dtype: int64
walmart 결측치 여부
: reviewId 0
content 0
score 0
thumbsUpCount 0
at 0
replyContent 23176
repliedAt 23176
appName 0
dtype: int64
-
- content 칼럼의 경우 결측치가 aliexpress의 경우 한 개의 칼럼만이 NaN이고, 그 외에서는 나타나지 않았습니다!
- 그 외에 유의미한 칼럼으로 생각했던 score와 thumbsUpCount의 경우 결측치가 존재하지 않아 값의 분포 정도만 확인하면 될 것으로 보입니다!
content 칼럼의 문자열 길이 확인
short_strings_alibaba = alibaba['content'].str.len() < 5
short_strings_aliexpress = aliexpress['content'].str.len() < 5
short_strings_amazon = amazon['content'].str.len() < 5
short_strings_daraz = daraz['content'].str.len() < 5
short_strings_Flip = Flip['content'].str.len() < 5
short_strings_lazada = lazada['content'].str.len() < 5
short_strings_meesho = meesho['content'].str.len() < 5
short_strings_myntra = myntra['content'].str.len() < 5
short_strings_shein = shein['content'].str.len() < 5
short_strings_snap = snap['content'].str.len() < 5
short_strings_walmart = walmart['content'].str.len() < 5
count_short_strings_alibaba = short_strings_alibaba.sum()
print(f"Alibaba: {count_short_strings_alibaba}")
count_short_strings_aliexpress = short_strings_aliexpress.sum()
print(f"AliExpress: {count_short_strings_aliexpress}")
count_short_strings_amazon = short_strings_amazon.sum()
print(f"Amazon: {count_short_strings_amazon}")
count_short_strings_daraz = short_strings_daraz.sum()
print(f"Daraz: {count_short_strings_daraz}")
count_short_strings_Flip = short_strings_Flip.sum()
print(f"Flipkart: {count_short_strings_Flip}")
count_short_strings_lazada = short_strings_lazada.sum()
print(f"Lazada: {count_short_strings_lazada}")
count_short_strings_meesho = short_strings_meesho.sum()
print(f"Meesho: {count_short_strings_meesho}")
count_short_strings_myntra = short_strings_myntra.sum()
print(f"Myntra: {count_short_strings_myntra}")
count_short_strings_shein = short_strings_shein.sum()
print(f"Shein: {count_short_strings_shein}")
count_short_strings_snap = short_strings_snap.sum()
print(f"Snapdeal: {count_short_strings_snap}")
count_short_strings_walmart = short_strings_walmart.sum()
print(f"Walmart: {count_short_strings_walmart}")
- 문자열 길이가 5보다 작은 content 칼럼을 조사해봤는데 전체 데이터 세트에서 그런 관측치는 존재하지 않아 보입니다. 일단 추가적인 데이터 가공이 필요할 것으로 보이지 않습니다!
score, thumbsUpCount 분포 체크
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("alibaba", "score", alibaba['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("alibaba", "thumbsUpCount", alibaba['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("aliexpress", "score", aliexpress['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("aliexpress", "thumbsUpCount", aliexpress['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("amazon", "score", amazon['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("amazon", "thumbsUpCount", amazon['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("daraz", "score", daraz['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("daraz", "thumbsUpCount", daraz['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("Flip", "score", Flip['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("Flip", "thumbsUpCount", Flip['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("lazada", "score", lazada['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("lazada", "thumbsUpCount", lazada['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("meesho", "score", meesho['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("meesho", "thumbsUpCount", meesho['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("myntra", "score", myntra['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("myntra", "thumbsUpCount", myntra['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("shein", "score", shein['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("shein", "thumbsUpCount", shein['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("snap", "score", snap['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("snap", "thumbsUpCount", snap['thumbsUpCount'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("walmart", "score", walmart['score'].describe()))
print("{0}의 {1} 칼럼 분포 : \n {2} \n\n".format("walmart", "thumbsUpCount", walmart['thumbsUpCount'].describe()))
alibaba의 score 칼럼 분포 :
count 99000.000000
mean 2.749737
std 1.760930
min 1.000000
25% 1.000000
50% 2.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
alibaba의 thumbsUpCount 칼럼 분포 :
count 99000.000000
mean 6.077798
std 51.276206
min 0.000000
25% 0.000000
50% 0.000000
75% 1.000000
max 5657.000000
Name: thumbsUpCount, dtype: float64
aliexpress의 score 칼럼 분포 :
count 126000.000000
mean 3.828857
std 1.615255
min 1.000000
25% 3.000000
50% 5.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
aliexpress의 thumbsUpCount 칼럼 분포 :
count 126000.000000
mean 2.691317
std 36.811383
min 0.000000
25% 0.000000
50% 0.000000
75% 0.000000
max 7851.000000
Name: thumbsUpCount, dtype: float64
amazon의 score 칼럼 분포 :
count 99000.000000
mean 2.749737
std 1.760930
min 1.000000
25% 1.000000
50% 2.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
amazon의 thumbsUpCount 칼럼 분포 :
count 99000.000000
mean 6.077798
std 51.276206
min 0.000000
25% 0.000000
50% 0.000000
75% 1.000000
max 5657.000000
Name: thumbsUpCount, dtype: float64
daraz의 score 칼럼 분포 :
count 54000.000000
mean 3.267852
std 1.764175
min 1.000000
25% 1.000000
50% 4.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
daraz의 thumbsUpCount 칼럼 분포 :
count 54000.000000
mean 11.000778
std 167.390656
min 0.000000
25% 0.000000
50% 0.000000
75% 0.000000
max 11049.000000
Name: thumbsUpCount, dtype: float64
Flip의 score 칼럼 분포 :
count 18000.000000
mean 1.753778
std 1.336091
min 1.000000
25% 1.000000
50% 1.000000
75% 2.000000
max 5.000000
Name: score, dtype: float64
Flip의 thumbsUpCount 칼럼 분포 :
count 18000.000000
mean 53.877111
std 581.957376
min 0.000000
25% 0.000000
50% 0.000000
75% 2.000000
max 27991.000000
Name: thumbsUpCount, dtype: float64
lazada의 score 칼럼 분포 :
count 54000.000000
mean 3.263759
std 1.797496
min 1.000000
25% 1.000000
50% 4.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
lazada의 thumbsUpCount 칼럼 분포 :
count 54000.000000
mean 14.062407
std 157.176764
min 0.000000
25% 0.000000
50% 0.000000
75% 2.000000
max 12563.000000
Name: thumbsUpCount, dtype: float64
meesho의 score 칼럼 분포 :
count 36000.000000
mean 2.351528
std 1.747566
min 1.000000
25% 1.000000
50% 1.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
meesho의 thumbsUpCount 칼럼 분포 :
count 36000.000000
mean 29.018417
std 469.622676
min 0.000000
25% 0.000000
50% 0.000000
75% 2.000000
max 34774.000000
Name: thumbsUpCount, dtype: float64
myntra의 score 칼럼 분포 :
count 36000.000000
mean 1.990583
std 1.556744
min 1.000000
25% 1.000000
50% 1.000000
75% 3.000000
max 5.000000
Name: score, dtype: float64
myntra의 thumbsUpCount 칼럼 분포 :
count 36000.000000
mean 19.647056
std 177.842064
min 0.000000
25% 0.000000
50% 0.000000
75% 2.000000
max 10088.000000
Name: thumbsUpCount, dtype: float64
shein의 score 칼럼 분포 :
count 40500.000000
mean 4.011778
std 1.474956
min 1.000000
25% 4.000000
50% 5.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
shein의 thumbsUpCount 칼럼 분포 :
count 40500.000000
mean 16.754272
std 229.421734
min 0.000000
25% 0.000000
50% 0.000000
75% 2.000000
max 15683.000000
Name: thumbsUpCount, dtype: float64
snap의 score 칼럼 분포 :
count 27000.000000
mean 2.197741
std 1.735706
min 1.000000
25% 1.000000
50% 1.000000
75% 4.000000
max 5.000000
Name: score, dtype: float64
snap의 thumbsUpCount 칼럼 분포 :
count 27000.000000
mean 8.555259
std 94.579192
min 0.000000
25% 0.000000
50% 0.000000
75% 1.000000
max 6037.000000
Name: thumbsUpCount, dtype: float64
walmart의 score 칼럼 분포 :
count 45000.000000
mean 2.694867
std 1.698065
min 1.000000
25% 1.000000
50% 2.000000
75% 5.000000
max 5.000000
Name: score, dtype: float64
walmart의 thumbsUpCount 칼럼 분포 :
count 45000.000000
mean 3.964556
std 30.743114
min 0.000000
25% 0.000000
50% 0.000000
75% 1.000000
max 2146.000000
Name: thumbsUpCount, dtype: float64
- score의 경우 최소 1점, 최대 5점의 분포를 전형적인 모습을 보여서 이 부분은 추후에 그래프를 통해서 전체 분포를 체크해봐도 좋을 것 같습니다!
- thumbsUpCount의 경우 많은 동의를 얻을 수록 해당 리뷰가 쇼핑몰 앱에 대한 사용자들의 의견을 잘 보여준다고 판단할 수 있기 때문에 thumbsUpCount의 값이 0인 데이터는 제거하고, 특정 갯수 이상의 동의를 얻은 데이터 내에서 랜덤 추출해도 좋을 것 같다고 생각됩니다!
'Self-Taught > Machine Learning' 카테고리의 다른 글
ECC 프로젝트) 2차 회의용 _ 데이터 분석 내용 (1) | 2025.01.30 |
---|---|
머신러닝 완벽 가이드 _ CH.8 : 텍스트 분석 (2) (2) | 2024.12.26 |
머신러닝 완벽 가이드 _ CH.7 : 군집화 (0) | 2024.11.30 |
파이썬 머신러닝 완벽 가이드 _CH.6 (0) | 2024.11.23 |
파이썬 머신러닝 완벽 가이드 _CH.5 (0) | 2024.11.16 |