pyechats df数据生成折线图

导包

import pyecharts.options as opts

from pyecharts.faker import Faker

from pyecharts.charts import Line

from pyecharts.globals import ThemeType

import numpy as np

import pandas as pd

数据 纯属虚构

months = pd.DataFrame(pd.date_range("2018/9/30","2020/1/31",freq="M"),columns=["Date"])

months["Date"] = months.Date.map(lambda x:x.strftime("%Y-%m"))

months["Value"]= [54986,54946,54931,54778,54730,54619,54512,54492,54446,54382,54314,54288,54278,54256,54240,54191,54185]

画图

line =(Line(init_opts = opts.InitOpts(width="800px",height="400px",theme = ThemeType.DARK))

      .add_xaxis(list(months.Date))

      .add_yaxis("房价",list(months.Value))

      .set_global_opts(title_opts = opts.TitleOpts(title = "房价走势图",subtitle="单位: 元/m2"),

                                 yaxis_opts = opts.AxisOpts(min_=54000,max_=55000),

                                 xaxis_opts = opts.AxisOpts(axislabel_opts = opts.LabelOpts(rotate = 60))))

line.render_notebook()

数据纯属虚构
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。