Python Pandas 时间序列双轴折线图
时间序列pv-gmv双轴折线图
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt n = 12
date_series = pd.date_range(start='2018-01-01', periods=n, freq="D") data = {
'pv': [10000, 12000, 13000, 11000, 9000, 16000, 10000, 12000, 13000, 11000, 9000, 16000],
'gmv': [100, 90, 120, 150, 200, 80, 100, 90, 120, 150, 200, 80]
} df = pd.DataFrame(data, index=date_series) ax = df.plot(
secondary_y=['gmv'],
x_compat=True,
grid=True) ax.set_title("pv-gmv")
ax.set_ylabel('pv')
ax.grid(linestyle="--", alpha=0.3) ax.right_ax.set_ylabel('gmv') plt.show()

import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt n = 12
date_series = pd.period_range(start='2018-01', periods=n, freq="M") data = {
'pv': [10000, 12000, 13000, 11000, 9000, 16000, 10000, 12000, 13000, 11000, 9000, 16000],
'gmv': [100, 90, 120, 150, 200, 80, 100, 90, 120, 150, 200, 80]
} df = pd.DataFrame(data, index=date_series) ax = df.plot(
secondary_y=['gmv'],
x_compat=True,
grid=True) ax.set_title("pv-gmv")
ax.set_ylabel('pv')
ax.grid(linestyle="--", alpha=0.3) ax.right_ax.set_ylabel('gmv') plt.show()

Python Pandas 时间序列双轴折线图的更多相关文章
- 4-Highcharts曲线图之时间轴折线图
鼠标按住左键 左右移动可以试试<!DOCTYPE> <html lang='en'> <head> <title>4-Highcharts曲线图之时间轴 ...
- highcharts.js的时间轴折线图
工作中正好用到. 鼠标按住左键 左右移动可以试试 <!DOCTYPE> <html lang='en'> <head> <title>4-Highcha ...
- python的turtle模块画折线图
代码如下: import turtle yValues = [10.0,7.4,6.4,5.3,4.4,3.7,2.6] def main(): t = turtle.Turtle() t.hidet ...
- echarts双y轴折线图柱状图混合实时更新图
先看下效果,自己用ps做了张gif图,发现很好玩啊..不喜勿喷 自己下载个echarts.min.js 直接上代码: <!DOCTYPE html><html><head ...
- Python——Pandas 时间序列数据处理
介绍 Pandas 是非常著名的开源数据处理库,我们可以通过它完成对数据集进行快速读取.转换.过滤.分析等一系列操作.同样,Pandas 已经被证明为是非常强大的用于处理时间序列数据的工具.本节将介绍 ...
- python ---Pandas时间序列:生成指定范围的日期
引入包 import pandas as pd import numpy as np 1.生成指定范围的日期 print pd.date_range('11/1/2018','11/9/2018') ...
- python画最最简单的折线图
# encoding=utf-8import matplotlib.pyplot as pltfrom pylab import * #支持中文mpl.rcParams['font.sans-seri ...
- pandas 数据可视化之折线图
官网地址:https://openpyxl.readthedocs.io/en/stable/charts/line.html#id1 openpyxl+pandas # coding=utf-8 i ...
- matlab 双坐标折线图画法
%%各时段电量需求 clc close all clear all cost_gd = [2200 1800 3800 4600]; cost_bj = [2.7 2.2 1.8 3.6]; cost ...
随机推荐
- pygame-KidsCanCode系列jumpy-part8-记录历史最高分
通常在多玩家的游戏中,每个玩家都会有自己的得分,最高分数会成为该游戏的最佳记录.这一篇,学习下如何记录最高得分:(为了简化代码,本文采用文件方式,仅记录本机得分,明白原理后,可以将得分保存在云端或数据 ...
- 解决 docker 报错: Error starting daemon: error initializing graphdriver: backing file system is unsupported for this graph driver
CentOS 7.5 x64下 sudo yum install docker -y systemctl enable docker systemctl start docker 发现启动失败 jou ...
- 微信小程序判断用户是否需要再次授权获取个人信息
一.index.js设置如下 //获取用户的授权信息,放到本地缓存中 wx.getSetting({ success: (res) => { if(res.authSetting['scope. ...
- Javascript 面向对象的编程思想
面向对象,首先得有类的概念,没有类造不出来对象,,Javascript把函数名看成类. 其次分为不同结构层,如三层架构.MVC.MVVM. 本文根据实际项目演练,分为几个适用的结构层,如果项目不大一般 ...
- 【MVP时间】5节课助你破解物联网硬件接入难点
视频播放链接:https://mvp.aliyun.com/topic/10?spm=5176.8961170.detail.18.31a3yK4zyK4zUc 1.会上网的鸡,有啥不一样? http ...
- CAShapeLayer(UIBezierPath)、CAGradientLayer绘制动态小车
看到一个大神写的代码,引用过来让大家看看! // 1.CAShapeLayer是一种特殊的层,可以在上面渲染图形. // 2.CAShapeLayer继承自CALayer,可使用CALayer的所 ...
- php的Allowed memory size of 134217728 bytes exhausted问题解决办法
php的Allowed memory size of 134217728 bytes exhausted问题解决办法 报错: Fatal error: Allowed memory size of 1 ...
- 【C++】C++中的数组
目录结构: contents structure [-] 一维数组 数组的定义和初始化 数组元素的访问 数组和指针 多维数组 数组是存放相同类型的容器,数组的大小确定不变,不能随意向数组中添加元素.因 ...
- Metadata GC Threshold导致的full gc分析
gc log 两次full gc 均是Metadata GC导致, OpenJDK -Bit Server VM ( :: by (Red Hat -) Memory: 4k page, physic ...
- Android 源码学习
工具篇:如何使用 Visual Studio Code 阅读 Android 源码:https://jekton.github.io/2018/05/11/how-to-read-android-so ...