Anda di halaman 1dari 4

Riandhika Vianto (17818821) - 4MA88 - Week7.ipynb.

txt - Colaboratory

Praktikum V
Selamat datang pada praktikum unggulan minggu ke - 5.

1_L0464qoX7pSkIQMBcF73Tg.png

Gambar diatas menunjukkan tahapan yang Anda perlu lakukan ketika ingin membangun sebuah model artificial intelligence. Pada minggu ini
Anda akan melakukan fase data cleansing atau pembersihan data. Tahapan ini biasanya dilakuakan sebelum anda melakukan tahapan EDA
yang telah Anda pelajari sebelumnya. Tahapan ini perlu dilakukan jika data yang Anda miliki tidak 'bersih', sehingga perlu dilakukan pemrosesan
terlebih dahulu (tahapan pre-processing) sebelum data tersebut masuk kedalam algoritma pembangunan model.

Materi praktikum ini dibagi menjadi 2 bagian dengan menggunakan dua dataset yang berbeda. Adapun operasi akan Anda lakukan antara lain

Melihat bentuk data (shape) dari data train dan test set
Cek data NaN, bila ada maka hapus/drop data NaN tsb
Cek outliers, bila ada maka hapus/drop outliers tsb
Melakukan konversi jenis kolom yang relevan.
Melakukan transformasi terhadap data yang bersifat kategori

Operasi yang Anda lakukan pada tahapan pembersihan data sangat bergantung pada karakteristik permasalahan, karakter data, serta jenis
data yang terdapat dalam dataset Anda. Sebagai referensi, berikut bagan dari berbagai macam tipe data yang mungkin Anda temui dalam
sebuah dataset.

8UUywzzaMhY2ZGHrWE7VkA_b.png

import numpy as np
import pandas as pd
import sklearn
import seaborn as sns
import matplotlib.pyplot as plt

Dataset 1
Dataset yang akan Anda gunakan pada praktikum kali ini adalah dataset survei tingkat kepuasan di Starbucks.

# Load data train dan test ke dalam pandas dataframe


# dataset : https://gitlab.com/andreass.bayu/file-directory/-/raw/main/Starbucks_satisfactory_survey.csv
concrete = pd.read_csv("https://gitlab.com/andreass.bayu/file-directory/-/raw/main/Starbucks_satisfactory_survey.csv")

# menghasilkan jumlah baris dan jumlah kolom (bentuk data) pada data train dengan fungsi .shape
concrete.shape

(122, 21)

# menampilkan 10 data teratas


concrete.head(10)

9. Do you
4. What 5. How 6. How do 7. How much time 8. The nearest 10. What do you 11. On average, how 12. How would you rate the quality of 13. How would you 15. How would you rate 16. You rate 17. How would you rate the 18. How likely you will choose 19. How do you come to 20. Will you
1. 2. have 14. How important are
3. Are you is your often do you usually do you normally Starbucks's most frequently much would you spend Starbucks compared to other brands rate the price the ambiance at the WiFi service at Starbucks? Starbucks for doing business hear of promotions at continue
Timestamp Your Your Starbucks sales and promotions in
currently. ....... ? annual you visit enjoy spend during your outlet to you purchase at at Starbucks per (Coffee Bean, Old Town White Coffee..) range at Starbucks? (lighting, quality at (Promptness, friendliness, meetings or hangout with Starbucks? Check all that buying at
Gender Age membership your purchase decision?
income? Starbucks? Starbucks? visit? is...? Starbucks? visit? to be: Starbucks? music, etc...) Starbucks as.. etc..) friends? apply. Starbucks?
card?

2019/10/01 From
12:38:43 Less than Starbucks Website/Apps;Social
0 Female 20 to Student Rarely Dine in Between 30 minutes to within 1km Yes Coffee Less than RM20 4 3 5 5 4 4 3 Yes
PM RM25,000 1 hour Media;Emails;Dea...
29
GMT+8

2019/10/01 From
1 12:38:54 Student Less than
Female 20 to Rarely Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
PM RM25,000
29
GMT+8

2019/10/01 From
12:38:56 Less than
2 Male 20 to Employed Monthly Dine in Between 30 minutes to more than 3km Yes Coffee Less than RM20 4 3 4 4 4 4 3 In Store displays;Billboards Yes
PM RM25,000 1 hour
29
GMT+8

2019/10/01 From
12:39:08 Less than Through friends and word of
3 Female 20 to Student Rarely Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 No
PM RM25,000 mouth
29
GMT+8

2019/10/01 From
12:39:20 Less than Between 30 minutes to Starbucks Website/Apps;Social
4 Male 20 to Student Monthly Take away 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Yes
PM RM25,000 1 hour Media
29
GMT+8

2019/10/01 From
12:39:39 Less than
5 Female 20 to Student Rarely Dine in Between 30 minutes to more than 3km No Cold drinks Less than RM20 4 3 5 5 4 5 4 Social Media Yes
PM RM25,000 1 hour
29
GMT+8

2019/10/01 From
12:39:42 Less than Starbucks Website/Apps;Social
6 Female 20 to Student Rarely Dine in Below 30 minutes within 1km Yes Coffee Around RM20 - RM40 5 5 5 5 3 5 5 Yes
PM RM25,000 Media
29
GMT+8

2019/10/01 From RM50,000


12:40:58 Starbucks Website/Apps;Social
7 Male 20 to Employed - Rarely Dine in Between 30 minutes to more than 3km Yes Coffee;Cold drinks Less than RM20 4 2 3 3 3 3 3 Yes
PM 1 hour Media;Emails;Thr...
29 RM100,000
GMT+8

2019/10/01 From
12:42:27 Less than Starbucks Website/Apps;Social
8 Female 20 to Student Rarely Drive-thru Below 30 minutes more than 3km Yes Cold drinks More than RM40 5 4 4 4 4 4 4 Yes
PM RM25,000 Media;Through fr...
29
GMT+8

2019/10/01
12:43:36 From Less than Social Media;Through friends
9 Male 20 to Employed Monthly Take away Below 30 minutes more than 3km No Coffee Around RM20 - RM40 4 3 3 4 3 3 4 Yes
PM RM25,000 and word of mouth
GMT+8 29

# fungsi describe() untuk mengetahui statistika data untuk data numeric seperti count, mean, standard deviation, maximum, min inum, dan quartile.
concrete.describe()

12. How would you rate the quality of Starbucks compared to other brands (Coffee Bean, 13. How would you rate the price range 14. How important are sales and promotions in your 15. How would you rate the ambiance at Starbucks? 16. You rate the WiFi quality at 17. How would you rate the service at Starbucks? 18. How likely you will choose Starbucks for doing business meetings
Old Town White Coffee..) to be: at Starbucks? purchase decision? (lighting, music, etc...) Starbucks as.. (Promptness, friendliness, etc..) or hangout with friends?

count 122.000000 122.000000 122.000000 122.000000 122.000000 122.000000 122.000000

mean 3.663934 2.893443 3.795082 3.754098 3.254098 3.745902 3.516393

std 0.941343 1.081836 1.090443 0.929867 0.958317 0.828834 1.030394

min 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000

25% 3.000000 2.000000 3.000000 3.000000 3.000000 3.000000 3.000000

50% 4.000000 3.000000 4.000000 4.000000 3.000000 4.000000 4.000000

75% 4.000000 4.000000 5.000000 4.000000 4.000000 4.000000 4.000000

max 5.000000 5.000000 5.000000 5.000000 5.000000 5.000000 5.000000

#cek nilai yang hilang / missing values di dalam data train


concrete.isnull().sum().sort_values(ascending=False)

6. How do you usually enjoy Starbucks? 1


19. How do you come to hear of promotions at Starbucks? Check all that apply. 1
20. Will you continue buying at Starbucks? 0
9. Do you have Starbucks membership card? 0
1. Your Gender 0
2. Your Age 0
3. Are you currently....? 0
4. What is your annual income? 0
5. How often do you visit Starbucks? 0
7. How much time do you normally spend during your visit? 0
8. The nearest Starbucks's outlet to you is...? 0
10. What do you most frequently purchase at Starbucks? 0
11. On average, how much would you spend at Starbucks per visit? 0
12. How would you rate the quality of Starbucks compared to other brands (Coffee Bean, Old Town White Coffee..) to be: 0
13. How would you rate the price range at Starbucks? 0
14. How important are sales and promotions in your purchase decision? 0
15. How would you rate the ambiance at Starbucks? (lighting, music, etc...) 0
16. You rate the WiFi quality at Starbucks as.. 0
17. How would you rate the service at Starbucks? (Promptness, friendliness, etc..) 0
18. How likely you will choose Starbucks for doing business meetings or hangout with friends? 0
Timestamp 0
dtype: int64

https://colab.research.google.com/drive/1pi7pWRGa26N0N0qjDChLd8B1NVVO78mj#scrollTo=g0qvnGY3daXV&printMode=true 1/4
Riandhika Vianto (17818821) - 4MA88 - Week7.ipynb.txt - Colaboratory

Missing values adalah nilai yang tidak terdefinisi di dataset. Bentuknya beragam, bisa berupa blank cell, ataupun simbol-simbol tertentu seperti
NaN (Not a Number), NA (Not Available), ?, -, dan sebagainya. Missing values dapat menjadi masalah dalam analisis data serta tentunya dapat
mempengaruhi hasil modelling machine learning.

Instruksi Praktikum untuk mahasiswa SosHum


Lakukan data encoding dengan melakukan transformasi kolom - kolom berikut :

1. Your Gender -> gender

2. Your Age -> age

3. Are you currently ... ? -> status

4. What is your annual income? -> income

5. How often do you visit Starbucks? -> visitNo


Lakukan transformasi data untuk kolom - kolom berikut :

gender = 0 - Male, 1 - Female


age = 0 - Below 20, 1 - From 20 to 29, 2 - From 30 to 39, 3 - 40 and above
status = 0 - Student, 1 - Self-Employed, 2 - Employed, 3 - Housewife
income = 0 - Less than RM25,000, 1 - RM25,000 – RM50,000, 2 - RM50,000 – RM100,000, 3 - RM100,000 – RM150,000, 4 - More than
RM150,000
visitNo = 0 - Daily, 1 - Weekly, 3 - Monthly, 4 - Never
Lakukan analisis histogram untuk pengaruh kolom income terhadap kolom visitNo, apakah yang dapat Anda simpulkan ?
Berikan kesimpulan akhir anda terhadap survei kepuasan di Starbucks berdasarkan dataset yang digunakan

JAWABAN

list(concrete.columns)

['Timestamp',
'1. Your Gender',
'2. Your Age',
'3. Are you currently. ....?',
'4. What is your annual income?',
'5. How often do you visit Starbucks?',
'6. How do you usually enjoy Starbucks?',
'7. How much time do you normally spend during your visit?',
"8. The nearest Starbucks's outlet to you is. .. ?",
'9. Do you have Starbucks membership card?',
'10. What do you most frequently purchase at Starbucks?',
'11. On average, how much would you spend at Starbucks per visit?',
'12. How would you rate the quality of Starbucks compared to other brands (Coffee Bean, Old Town White Coffee..) to be:',
'13. How would you rate the price range at Starbucks?',
'14. How important are sales and promotions in your purchase decision?',
'15. How would you rate the ambiance at Starbucks? (lighting, music, etc....)',
'16. You rate the WiFi quality at Starbucks as..',
'17. How would you rate the service at Starbucks? (Promptness, friendliness, etc..)',
'18. How likely you will choose Starbucks for doing business meetings or hangout with friends?',
'19. How do you come to hear of promotions at Starbucks? Check all that apply.',
'20. Will you continue buying at Starbucks?']

## Data encoding dengan melakukan transformasi kolom - kolom


concreteRename = concrete.rename(columns={'1. Your Gender': 'gender', '2. Your Age': 'age', '3. Are you currently....?': 'status', '4. What is your annual income?': 'income', '5. How often do you visit Starbucks?': 'visitNo'})
concreteRename.head(5)

9. Do you
6. How do 8. The nearest 10. What do you 11. On average, how 12. How would you rate the quality of 13. How would you 16. You rate 17. How would you rate the 18. How likely you will choose 19. How do you come to 20. Will you
7. How much time do have 14. How important are 15. How would you rate the
you usually Starbucks's most frequently much would you spend Starbucks compared to other brands rate the price the WiFi service at Starbucks? Starbucks for doing business hear of promotions at continue
Timestamp gender age status income visitNo you normally spend Starbucks sales and promotions in ambiance at Starbucks?
enjoy outlet to you purchase at at Starbucks per (Coffee Bean, Old Town White Coffee..) to range at quality at (Promptness, friendliness, meetings or hangout with Starbucks? Check all that buying at
during your visit? membership your purchase decision? (lighting, music, etc...)
Starbucks? is...? Starbucks? visit? be: Starbucks? Starbucks as.. etc..) friends? apply. Starbucks?
card?

2019/10/01
From Starbucks Website/Apps;Social
12:38:43 Less than Between 30 minutes to within 1km Yes Coffee Less than RM20 4 3 5 5 4 4 3
0 Female 20 to Student Rarely Dine in Yes
PM RM25,000 1 hour Media;Emails;Dea...
29
GMT+8

2019/10/01 From
12:38:54 Less than
1 Female 20 to Student Rarely Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
PM RM25,000
29
GMT+8

2019/10/01 From
2 12:38:56 Less than Between 30 minutes to
Male 20 to Employed Monthly Dine in more than 3km Yes Coffee Less than RM20 4 3 4 4 4 4 3 In Store displays;Billboards Yes
PM RM25,000 1 hour
29
GMT+8

2019/10/01 From
12:39:08 Less than Through friends and word of
3 Female 20 to Student Rarely Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 No
PM RM25,000 mouth
29
GMT+8

2019/10/01 From
12:39:20 Less than Between 30 minutes to Starbucks Website/Apps;Social
4 Male 20 to Student Monthly Take away 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Yes
PM RM25,000 1 hour Media
29
GMT+8

concreteRename.gender.unique()

array(['Female', 'Male'], dtype=object)

concreteRename.age.unique()

array(['From 20 to 29', 'From 30 to 39', '40 and above', 'Below 20'],


dtype=object)

concreteRename.status.unique()

array(['Student', 'Employed', 'Self-employed', 'Housewife'], dtype=object)

concreteRename.income.unique()

array(['Less than RM25,000', 'RM50,000 - RM100,000',


'RM25,000 - RM50,000', 'RM100,000 - RM150,000',
'More than RM150,000'], dtype=object)

concreteRename.visitNo.unique()

array(['Rarely', 'Monthly', 'Weekly', 'Never', 'Daily'], dtype=object)

## Transformasi data untuk kolom gender


gender_map = {'Male':0, 'Female':1}

concreteRename['gender'] = concreteRename['gender'].map(gender_map)
concreteRename.head()

https://colab.research.google.com/drive/1pi7pWRGa26N0N0qjDChLd8B1NVVO78mj#scrollTo=g0qvnGY3daXV&printMode=true 2/4
Riandhika Vianto (17818821) - 4MA88 - Week7.ipynb.txt - Colaboratory

9. Do you
6. How do 8. The nearest 10. What do you 11. On average, how 12. How would you rate the quality of 13. How would you 16. You rate 17. How would you rate the 18. How likely you will choose 19. How do you come to 20. Will you
7. How much time do have 14. How important are 15. How would you rate the
you usually Starbucks's most frequently much would you spend Starbucks compared to other brands rate the price the WiFi service at Starbucks? Starbucks for doing business hear of promotions at continue
Timestamp gender age status income visitNo you normally spend Starbucks sales and promotions in ambiance at Starbucks?
enjoy outlet to you purchase at at Starbucks per (Coffee Bean, Old Town White Coffee..) to range at quality at (Promptness, friendliness, meetings or hangout with Starbucks? Check all that buying at
during your visit? membership your purchase decision? (lighting, music, etc...)
Starbucks? is...? Starbucks? visit? be: Starbucks? Starbucks as.. etc..) friends? apply. Starbucks?
card?

2019/10/01 From
Less than Starbucks Website/Apps;Social
0 12:38:43
PM 1 20 to Student RM25,000 Rarely Dine in Between 30 minutes to within 1km Yes Coffee Less than RM20 4 3 5 5 4 4 3 Yes
1 hour Media;Emails;Dea...
29
GMT+8
## Transformasi data untuk kolom age
age_map = {'Below 20':0, 'From 20 to 29':1, 'From 30 to 39':2, '40 and above':3}
2019/10/01
From
12:38:54 Less than
1
concreteRename['age'] 1 20 to Student Rarely
= concreteRename['age'].map(age_map) Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
PM 29 RM25,000
concreteRename.head()
GMT+8

2019/10/01
From 9. Do you
12:38:56 Less than 6. How do Between 30 minutes to 8. The nearest 10. What do you 11. On average, how 12. How would you rate the quality of 13. How would you 16. You rate 17. How would you rate the 18. How likely you will choose 19. How do you come to hear 20. Will you
2 0 20 to Employed Monthly Dine in 7. How much time do more than 3km Yes
have Coffee Less than RM20 4 3 14. How important are 4 15. How would you rate the 4 4 4 3 In Store displays;Billboards Yes
PM gender age RM25,000 you usually 1 hour Starbucks's most frequently much would you spend Starbucks compared to other brands rate the price the WiFi service at Starbucks? Starbucks for doing business of promotions at Starbucks? continue
Timestamp 29 status income visitNo enjoy you normally spend outlet to you Starbucks sales and promotions in ambiance at Starbucks? meetings or hangout with
GMT+8 purchase at at Starbucks per (Coffee Bean, Old Town White Coffee..) to range at quality at (Promptness, friendliness, buying at
Starbucks? during your visit? is...? membership Starbucks? visit? be: Starbucks? your purchase decision? (lighting, music, etc...) Starbucks as.. etc..) friends? Check all that apply. Starbucks?
2019/10/01 card?
From
12:39:08 Less than Through friends and word of
3 2019/10/01 1 20 to Student Rarely Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 No
PM RM25,000
Less than mouth
Starbucks Website/Apps;Social
0
12:38:43
GMT+8 1 129 Student Rarely Dine in
Between 30 minutes to within 1km Yes Coffee Less than RM20 4 3 5 5 4 4 3 Yes
PM RM25,000 1 hour Media;Emails;Dea...
GMT+8
2019/10/01 From
12:39:20 Less than Between 30 minutes to Starbucks Website/Apps;Social
4 2019/10/01 0 20 to Student Monthly Take away 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Yes
PM
12:38:54 Less than
RM25,000 1 hour Media
1 GMT+8 1 129 Student
RM25,000 Rarely Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
PM
GMT+8

2019/10/01
12:38:56 Less than Between 30 minutes to
2 0 1 Employed Monthly Dine in more than 3km Yes Coffee Less than RM20 4 3 4 4 4 4 3 In Store displays;Billboards Yes
PM RM25,000 1 hour
GMT+8

2019/10/01
12:39:08 Less than Through friends and word of
3 1 1 Student Rarely Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 No
PM RM25,000 mouth
GMT+8

2019/10/01
12:39:20 Less than Between 30 minutes to Starbucks Website/Apps;Social
4 0 1 Student Monthly Take away 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Yes
PM RM25,000 1 hour Media
GMT+8

## Transformasi data untuk kolom status


status_map = {'Student':0, 'Self-employed':1, 'Employed':2, 'Housewife':3}

concreteRename['status'] = concreteRename['status'].map(status_map)
concreteRename.head()

6. How do you 7. How much time do you 8. The nearest 9. Do you have 10. What do you most 11. On average, how much would 13. How would you rate 14. How important are sales and 15. How would you rate the ambiance 16. You rate the WiFi 17. How would you rate the service at 18. How likely you will choose Starbucks for 19. How do you come to hear of 20. Will you
12. How would you rate the quality of Starbucks compared to
Timestamp gender age status income visitNo usually enjoy normally spend during your Starbucks's outlet to Starbucks membership frequently purchase at you spend at Starbucks per the price range at promotions in your purchase at Starbucks? (lighting, music, quality at Starbucks Starbucks? (Promptness, friendliness, doing business meetings or hangout with promotions at Starbucks? Check all continue buying at
other brands (Coffee Bean, Old Town White Coffee..) to be:
Starbucks? visit? you is...? card? Starbucks? visit? Starbucks? decision? etc...) as.. etc..) friends? that apply. Starbucks?

2019/10/01 Less than


Rarely Dine in Between 30 minutes to 1 hour within 1km Yes Coffee Less than RM20 4 Starbucks Website/Apps;Social
0 12:38:43 PM 1 1 0 3 5 5 4 4 3 Media;Emails;Dea... Yes
RM25,000
GMT+8

2019/10/01
1 12:38:54 PM 1 1 0 Less than
Rarely Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
RM25,000
GMT+8

2019/10/01
2 12:38:56 PM 0 1 2 Less than
Monthly Dine in Between 30 minutes to 1 hour more than 3km Yes Coffee Less than RM20 4 3 4 4 4 4 3 In Store displays;Billboards Yes
RM25,000
GMT+8

2019/10/01
3 12:39:08 PM 1 1 0 Less than
Rarely Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 Through friends and word of mouth No
RM25,000
GMT+8

2019/10/01
4 12:39:20 PM 0 1 0 Less than
Monthly Take away Between 30 minutes to 1 hour 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Starbucks Website/Apps;Social Media Yes
GMT+8 RM25,000

## Transformasi data untuk kolom income


income_map = {'Less than RM25,000':0, 'RM25,000 - RM50,000':1, 'RM50,000 - RM100,000':2, 'RM100,000 - RM150,000':3, 'More than RM150,000':4}

concreteRename['income'] = concreteRename['income'].map(income_map)
concreteRename.head()

6. How do you 7. How much time do you 8. The nearest 9. Do you have 10. What do you most 11. On average, how much would 14. How important are sales and 15. How would you rate the ambiance 16. You rate the WiFi 17. How would you rate the service at 18. How likely you will choose Starbucks for 19. How do you come to hear of
12. How would you rate the quality of Starbucks compared to 13. How would you rate the 20. Will you continue
Timestamp gender age status income visitNo usually enjoy normally spend during your Starbucks's outlet to Starbucks membership frequently purchase at you spend at Starbucks per promotions in your purchase at Starbucks? (lighting, music, quality at Starbucks Starbucks? (Promptness, friendliness, doing business meetings or hangout with promotions at Starbucks? Check all that
other brands (Coffee Bean, Old Town White Coffee..) to be: price range at Starbucks? buying at Starbucks?
Starbucks? visit? you is...? card? Starbucks? visit? decision? etc...) as.. etc..) friends? apply.

2019/10/01
3 Starbucks Website/Apps;Social Yes
0 12:38:43 PM 1 1 0 0 Rarely Dine in Between 30 minutes to 1 hour within 1km Yes Coffee Less than RM20 4 3 5 5 4 4 Media;Emails;Dea...
GMT+8

2019/10/01
1 12:38:54 PM 1 1 0 0 Rarely Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
GMT+8

2019/10/01
2 12:38:56 PM 0 1 2 0 Monthly Dine in Between 30 minutes to 1 hour more than 3km Yes Coffee Less than RM20 4 3 4 4 4 4 3 In Store displays;Billboards Yes
GMT+8

2019/10/01
3 12:39:08 PM 1 1 0 0 Rarely Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 Through friends and word of mouth No
GMT+8

2019/10/01
4 12:39:20 PM 0 1 0 0 Monthly Take away Between 30 minutes to 1 hour 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Starbucks Website/Apps;Social Media Yes
GMT+8

## Transformasi data untuk kolom visitNo


visitNo_map = {'Daily':0, 'Weekly':1, 'Rarely':2, 'Monthly':3, 'Never':4}

concreteRename['visitNo'] = concreteRename['visitNo'].map(visitNo_map)
concreteRename.head()

https://colab.research.google.com/drive/1pi7pWRGa26N0N0qjDChLd8B1NVVO78mj#scrollTo=g0qvnGY3daXV&printMode=true 3/4
Riandhika Vianto (17818821) - 4MA88 - Week7.ipynb.txt - Colaboratory

9. Do you
6. How do 8. The nearest 10. What do you 11. On average, how 13. How would you 17. How would you rate the 20. Will you
7. How much time do have 12. How would you rate the quality of 14. How important are 15. How would you rate the 16. You rate the 18. How likely you will choose 19. How do you come to hear
you usually Starbucks's most frequently much would you spend rate the price service at Starbucks? continue
Timestamp gender age status income visitNo you normally spend Starbucks Starbucks compared to other brands (Coffee sales and promotions in ambiance at Starbucks? WiFi quality at Starbucks for doing business of promotions at Starbucks?
enjoy outlet to you purchase at at Starbucks per range at (Promptness, friendliness, buying at
during your visit? membership Bean, Old Town White Coffee..) to be: your purchase decision? (lighting, music, etc...) Starbucks as.. meetings or hangout with friends? Check all that apply.
Starbucks? is...? Starbucks? visit? Starbucks? etc..) Starbucks?
card?

2019/10/01
12:38:43 1 1 0 0 2 Dine in Between 30 minutes to within 1km Yes Coffee Less than RM20 4 3 5 5 4 4 3 Starbucks Website/Apps;Social Yes
0
PM 1 hour Media;Emails;Dea...
GMT+8

2019/10/01
1 12:38:54
1 1 0 0 2 Take away Below 30 minutes 1km - 3km Yes Cold drinks;Pastries Less than RM20 4 3 4 4 4 5 2 Social Media;In Store displays Yes
PM
GMT+8

2019/10/01
12:38:56
2
PM 0 1 2 0 3 Dine in Between 30 minutes to more than 3km Yes Coffee Less than RM20 4 3 4 4 4 4 3 In Store displays;Billboards Yes
1 hour
GMT+8

2019/10/01
12:39:08 Through friends and word of
3 1 0 0 2 Take away Below 30 minutes more than 3km No Coffee Less than RM20 2 1 4 3 3 3 3 No
PM 1 mouth
GMT+8

2019/10/01
12:39:20 Between 30 minutes to Starbucks Website/Apps;Social
4 0 1 0 0 3 Take away 1km - 3km No Coffee;Sandwiches Around RM20 - RM40 3 3 4 2 2 3 3 Yes
PM 1 hour Media
GMT+8

https://colab.research.google.com/drive/1pi7pWRGa26N0N0qjDChLd8B1NVVO78mj#scrollTo=g0qvnGY3daXV&printMode=true 4/4

Anda mungkin juga menyukai