星巴克店铺数据集描述性分析

项目简介

本次项目会利用pandas数据分析方法和matplotlib可视化手段对星巴克店铺的分布情况进行分析。

数据来源

本次使用的数据集来源于Kaggle官网,含有13个字段信息:

  • Brand 品牌
  • StoreNumber 店铺号码
  • StoreName 店铺名称
  • Ownership Type 所有权类型
  • StreetAddress 街道地址
  • City 店铺所在城市
  • State/Province 店铺所在州,省份
  • Country 店铺所在国家
  • Postcode 邮编
  • PhoneNumber 电话号码
  • Timezone 时区
  • Longitude 经度
  • Latitude 维度
# 设置cell多行输出

from IPython.core.interactiveshell import InteractiveShell 
InteractiveShell.ast_node_interactivity = 'all' #默认为'last'

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

os.chdir(r'E:\python_learn\train')
file_name='directory.csv'
data = pd.read_csv(file_name)  
data.head()
Brand Store Number Store Name Ownership Type Street Address City State/Province Country Postcode Phone Number Timezone Longitude Latitude
0 Starbucks 47370-257954 Meritxell, 96 Licensed Av. Meritxell, 96 Andorra la Vella 7 AD AD500 376818720 GMT+1:00 Europe/Andorra 1.53 42.51
1 Starbucks 22331-212325 Ajman Drive Thru Licensed 1 Street 69, Al Jarf Ajman AJ AE NaN NaN GMT+04:00 Asia/Dubai 55.47 25.42
2 Starbucks 47089-256771 Dana Mall Licensed Sheikh Khalifa Bin Zayed St. Ajman AJ AE NaN NaN GMT+04:00 Asia/Dubai 55.47 25.39
3 Starbucks 22126-218024 Twofour 54 Licensed Al Salam Street Abu Dhabi AZ AE NaN NaN GMT+04:00 Asia/Dubai 54.38 24.48
4 Starbucks 17127-178586 Al Ain Tower Licensed Khaldiya Area, Abu Dhabi Island Abu Dhabi AZ AE NaN NaN GMT+04:00 Asia/Dubai 54.54 24.51

定义问题

本次将围绕星巴克店铺所在地展开分析:

  • 星巴克店铺全球的分布情况——哪些国家,城市的星巴克店铺最多
  • 星巴克店铺在我国的分布情况

数据清洗

# 查看数据结构
data.info()  # → 25600条数据,4个字段
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 25600 entries, 0 to 25599
Data columns (total 13 columns):
Brand             25600 non-null object
Store Number      25600 non-null object
Store Name        25600 non-null object
Ownership Type    25600 non-null object
Street Address    25598 non-null object
City              25585 non-null object
State/Province    25600 non-null object
Country           25600 non-null object
Postcode          24078 non-null object
Phone Number      18739 non-null object
Timezone          25600 non-null object
Longitude         25599 non-null float64
Latitude          25599 non-null float64
dtypes: float64(2), object(11)
memory usage: 2.5+ MB
data.isna().sum()  # 缺失值查看
Brand                0
Store Number         0
Store Name           0
Ownership Type       0
Street Address       2
City                15
State/Province       0
Country              0
Postcode          1522
Phone Number      6861
Timezone             0
Longitude            1
Latitude             1
dtype: int64
  • 重点查看City,Country,State/Province这三个字段是否存在缺失值,发现City字段存在15个缺失值,考虑到要分析的是星巴克的店铺信息,若删除会缺失部分信息,选择补填处理
# 查看缺失的具体数据
data[data['City'].isna()]
Brand Store Number Store Name Ownership Type Street Address City State/Province Country Postcode Phone Number Timezone Longitude Latitude
5069 Starbucks 31657-104436 سان ستيفانو Licensed طريق الكورنيش أبراج سان ستيفانو NaN ALX EG NaN 20120800287 GMT+2:00 Africa/Cairo 29.96 31.2
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值