时间序列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 时间序列双轴折线图的更多相关文章

  1. 4-Highcharts曲线图之时间轴折线图

    鼠标按住左键 左右移动可以试试<!DOCTYPE> <html lang='en'> <head> <title>4-Highcharts曲线图之时间轴 ...

  2. highcharts.js的时间轴折线图

    工作中正好用到. 鼠标按住左键 左右移动可以试试 <!DOCTYPE> <html lang='en'> <head> <title>4-Highcha ...

  3. 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 ...

  4. echarts双y轴折线图柱状图混合实时更新图

    先看下效果,自己用ps做了张gif图,发现很好玩啊..不喜勿喷 自己下载个echarts.min.js 直接上代码: <!DOCTYPE html><html><head ...

  5. Python——Pandas 时间序列数据处理

    介绍 Pandas 是非常著名的开源数据处理库,我们可以通过它完成对数据集进行快速读取.转换.过滤.分析等一系列操作.同样,Pandas 已经被证明为是非常强大的用于处理时间序列数据的工具.本节将介绍 ...

  6. python ---Pandas时间序列:生成指定范围的日期

    引入包 import pandas as pd import numpy as np 1.生成指定范围的日期 print pd.date_range('11/1/2018','11/9/2018') ...

  7. python画最最简单的折线图

    # encoding=utf-8import matplotlib.pyplot as pltfrom pylab import * #支持中文mpl.rcParams['font.sans-seri ...

  8. pandas 数据可视化之折线图

    官网地址:https://openpyxl.readthedocs.io/en/stable/charts/line.html#id1 openpyxl+pandas # coding=utf-8 i ...

  9. matlab 双坐标折线图画法

    %%各时段电量需求 clc close all clear all cost_gd = [2200 1800 3800 4600]; cost_bj = [2.7 2.2 1.8 3.6]; cost ...

随机推荐

  1. Python 之 __new__() 方法与实例化(转)

    _new__() 是在新式类中新出现的方法,它作用在构造方法建造实例之前,可以这么理解,在 Python 中存在于类里面的构造方法 __init__() 负责将类的实例化,而在 __init__() ...

  2. SSD固态硬盘测试工具收集(持续更新)

    https://www.crsky.com/zhuanti/gutaiyingpanceshi.html https://www.crsky.com/zhuanti/ssdjiance.html ht ...

  3. Firefly-RK3399笔记

    有用的连接: Rockchip官方资料: http://opensource.rock-chips.com/wiki_Main_Page http://opensource.rock-chips.co ...

  4. ARM64 __create_page_tables分析

    span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }.CodeMirror ...

  5. Oralce sql (+) 补充

    Oracle  外连接 (1)左外连接 (左边的表不加限制)       (2)右外连接(右边的表不加限制)       (3)全外连接(左右两表都不加限制) 外连接(Outer Join) oute ...

  6. .Net转Java.08.format

    %[index$][标识][最小宽度]转换方式 [index$]可以用于表示对第index个参数进行格式化, // Java代码 String s1=String.format("%3$s, ...

  7. iOS链接库的冲突

    最近在打包的时候,遇到一个坑.特此记录一下 起因是发现 Unity 5.4 版本,使用c#写的下载,下载速度无法突破 2M/s,同样的网络,后来横向对比使用原来 Cocos2d 开始的游戏,可以达到 ...

  8. Spark(四十五):Schema Registry

    很多时候在流数据处理时,我们会将avro格式的数据写入到kafka的topic,但是avro写入到kafka的时候,数据有可能会与版本升级,也就是schema发生变化,此时如果消费端,不知道哪些数据的 ...

  9. TensorFlow迭代速度变慢的问题

    最近用TensorFlow实现遗传算法(Genetic Algorithms),发现迭代速度越来越慢,用time.time()观察以后,发现每次迭代都要比上一次慢0.5秒左右,但是每次迭代的计算量是差 ...

  10. 每天一个linux命令:vmstat

    1.命令简介 vmstat(Virtual Memory Statistics 虚拟内存统计) 命令用来显示Linux系统虚拟内存状态,也可以报告关于进程.内存.I/O等系统整体运行状态. 2.用法 ...