jupyter能写Java吗,在jupyter实现数据的可视化

import pandas as pd

import numpy as np

import matplotlib

import matplotlib.pyplot as plt

%matplotlib inline

df=pd.read_csv('D:\order.csv',encoding="gbk")   #读取数据

df.head(100)

maoyan_key_factors = df[['title','score']]

maoyan_key_factors.head(100)

maoyan_score = maoyan_key_factors[['title', 'score']]

groupby_score = maoyan_score.groupby('score')

total_groupby_score = groupby_score.count()

print(total_groupby_score.rename(columns={'score':'Total'}))

c_score = total_groupby_score.plot(kind='bar')

c_score.set_title('Scoring statistics for the top 100 movie of cat eye movie')

c_score.set_ylabel('Count')

------------------------------------------------------

我自己的代码如下:

import pandas as pd

import numpy as np

import matplotlib

import matplotlib.pyplot as plt

%matplotlib inline

df=pd.read_csv('D:\order.csv',encoding="gbk")   #读取数据

df.head(1000)

print(df)这块可以直接把 df打印出来看下结果

maoyan_key_factors = df[['x_id','pay_amount']]

maoyan_key_factors.head(100)

maoyan_score = maoyan_key_factors[['x_id', 'pay_amount']]

groupby_score = maoyan_score.groupby('x_id')

total_groupby_score = groupby_score.count()

total_groupby_score.rename(columns={'pay_amount':'Total'})

c_score = total_groupby_score.plot(kind='bar')

c_score.set_title('Scoring statistics for the top 100 movie of cat eye movie')

c_score.set_ylabel('Count')

图表自己都出来了,非常方便。

感叹,这要拿编程语言写半天,还不知道对错!!!!!

备注:csv的文件格式如下:逗号分隔

order_id 订单号

x_id 商 户id

total_amount 订单金额

pay_amount 支付金额

order_id,x_id,total_amount,pay_amount

201906201520073329387129,33,100,1

201906201527017853969512,33,100,1

201906201533561091291430,33,100,1

201906201544143447127726,11,10,1

201906201545406603430237,33,30,30

201906201548385687686104,11,10,1

201906201556535835619315,11,10,1

201906201601409742676819,11,10,1

201906201604045190468329,11,10,1

201906201612152955596419,11,18,1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值