美团分析

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
meituan=pd.read_csv('meituan.csv')
meituan.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1680 entries, 0 to 1679
Data columns (total 8 columns):
web-scraper-order        1680 non-null object
web-scraper-start-url    1680 non-null object
name                     1680 non-null object
address                  1680 non-null object
rating                   1680 non-null float64
comment                  1680 non-null float64
price                    1667 non-null float64
cat                      1680 non-null object
dtypes: float64(3), object(5)
memory usage: 105.1+ KB
meituan.head(10)
web-scraper-orderweb-scraper-start-urlnameaddressratingcommentpricecat
01563028765-1694http://sh.meituan.com/meishi/c35/pn8/斯比特花园意大利餐厅(新世界大丸百货店)黄浦区南京东路228号新世界大丸百货6层人均4.22169.098.0foreign
11563028775-1753http://sh.meituan.com/meishi/c35/pn3/好伦哥自助餐厅(南京东路店)黄浦区南京东路600号亚太广场6楼1室人均3.06005.073.0foreign
21563028769-1720http://sh.meituan.com/meishi/c35/pn6/蘭赫咖啡(周浦店)浦东新区年家浜路327号三楼(全季酒店三楼)人均4.2326.055.0foreign
31563028721-1396http://sh.meituan.com/meishi/c35/pn29/地中海的月亮(虹桥·食尚天地店)青浦区沪青平公路1899号虹桥·食尚天地1栋1层106-3人均3.50.0107.0foreign
41563028767-1705http://sh.meituan.com/meishi/c35/pn7/拉蒂娜巴西烤肉自助餐Latina(长泰店)浦东新区祖冲之路1239弄长泰广场1E09东庭院(地铁2号线4号出口左侧50米,星巴克后面)人均3.4657.0148.0foreign
51563028727-1432http://sh.meituan.com/meishi/c35/pn26/R Bar & Restaurant徐汇区乌鲁木齐中路247号一层-10人均4.50.0140.0foreign
61563028735-1488http://sh.meituan.com/meishi/c35/pn22/芝根芝底(西渡店)奉贤区沪杭公路215号(邮政储蓄银行旁)人均5.0370.033.0foreign
71563028729-1445http://sh.meituan.com/meishi/c35/pn25/Barolo steakhouse巴洛洛意大利牛排餐厅黄浦区建国中路155弄7号人均5.01.0238.0foreign
81563028777-1778http://sh.meituan.com/meishi/c35/pn2/斗牛士牛排(南京东路悦荟店)黄浦区南京东路353号悦荟广场(原353店)7F(置地广场旁边)人均4.41285.0120.0foreign
91563028723-1412http://sh.meituan.com/meishi/c35/pn28/佩德罗巴西烤肉餐厅(禹州商业广场店)浦东新区沪南公路9936弄(禹州商业广场2层)人均3.083.0103.0foreign
meituan = meituan.dropna(subset=["price"])
meituan['rating']=meituan['rating'].fillna(3)
meituan['comment']=meituan['comment'].fillna(0)
meituan.describe()
ratingcommentprice
count1667.0000001667.0000001667.000000
mean4.204079512.169166109.988002
std0.5205571415.56775193.524620
min3.0000000.0000009.000000
25%3.9000006.00000060.000000
50%4.10000049.00000089.000000
75%4.500000369.500000123.000000
max5.00000024585.0000001670.000000
cols=['rating','comment','price']
meituan[cols].corr()
ratingcommentprice
rating1.0000000.0768820.189531
comment0.0768821.000000-0.128461
price0.189531-0.1284611.000000
plt.figure(figsize=(10,8)) 
sns.scatterplot(x="price", y="rating", data=meituan)
<matplotlib.axes._subplots.AxesSubplot at 0x1a22829d68>

[外链图片转存失败(img-kJvg89yF-1568259699618)(output_10_1.png)]

bins=[3,3.5,4,4.5,5]
labels=['<=3.5','<=4',"<=4.5","<=5"]
meituan['rating2']=pd.cut(meituan.rating,bins,right=True,labels=labels)
meituan.groupby(['rating2'])['rating'].describe()
countmeanstdmin25%50%75%max
rating2
<=3.5209.03.4755980.0565663.23.53.53.53.5
<=4495.03.8927270.1278433.63.83.94.04.0
<=4.5537.04.3368720.1547144.14.24.44.54.5
<=5395.04.9177220.1311414.64.85.05.05.0
plt.figure(figsize=(10,5))
sns.boxplot(x='rating',y='cat',palette=sns.color_palette('pastel'),data=meituan)
plt.tick_params(labelsize=20)

[外链图片转存失败(img-lcfmqGy4-1568259699619)(output_13_0.png)]

plt.figure(figsize=(10,5))
sns.boxplot(x='price',y='cat',palette=sns.color_palette('pastel'),data=meituan)
plt.tick_params(labelsize=20)

[外链图片转存失败(img-33kZuZ1v-1568259699620)(output_14_0.png)]

sns.countplot(x="cat",hue='rating2',data=meituan)
<matplotlib.axes._subplots.AxesSubplot at 0x1a23b7c2b0>

[外链图片转存失败(img-flbbhiCo-1568259699620)(output_15_1.png)]

sns.barplot(x="cat",y="comment",hue="rating2",data=meituan)
<matplotlib.axes._subplots.AxesSubplot at 0x1a23c49a20>

[外链图片转存失败(img-JjRFfTvi-1568259699621)(output_16_1.png)]


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值