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 ...
随机推荐
- fixed和sticky
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>f ...
- javaScript系列 [03]-javaScript原型对象
[03]-javaScript原型对象 引用: javaScript是一门基于原型的语言,它允许对象通过原型链引用另一个对象来构建对象中的复杂性,JavaScript使用原型链这种机制来实现动态代理. ...
- android:第十章,后台的默默劳动者——服务,学习笔记
一.多线程 1)本章首先介绍了安卓的多线程编程,说明在子线程中如果要修改UI,必须通过Handler, Message, MessageQueue, Looper来实现,但是这样毕竟太麻烦了. 2) ...
- Data type conversion in MongoDB
[问题] I have a collection called Document in MongoDB. Documents in this collection have a field calle ...
- [Algorithm] Fibonacci Sequence - Anatomy of recursion and space complexity analysis
For Fibonacci Sequence, the space complexity should be the O(logN), which is the height of tree. Che ...
- Eclipse中Project的属性Deployment Assembly(部署程序集)消失了,不存在了,去哪儿了
1. 该项目不是web项目,所以不存在Deployment Assembly 属性.在Eclipse中,怎样将一个非web project变成一个web project? 1)右键项目,选择Proje ...
- iqiyi__youku__cookie_设置
iqiyi设置cookie var string = "此处替换iqiyi的cookie"; var getCookie = function( str) { var cookie ...
- java 定时任务之一 @Scheduled注解(第一种方法)
使用spring @Scheduled注解执行定时任务: 运行!!! 关于Cron表达式(转载) 表达式网站生成: http://cron.qqe2.com/ 直接点击 作者:http://blog ...
- selenium面试题总结
2017年7月17日更新:已经更新部分答案 答案链接 今天有同学问到seleinum面试的时候会问到的问题,随便想了想,暂时纪录一下.欢迎大家在评论中提供更多问题. 去哪儿的面试题 selenium中 ...
- 通过itools安装ipa时,如果装不上提示"Mismatche...onIdentifierEntitlement"
最后安装ipa时,如果装不上提示"Mismatche...onIdentifierEntitlement",一定要卸载设备里的现有的微信app!!!!!!!!!!!!!还有就是,如 ...