婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > python實現(xiàn)股票歷史數(shù)據(jù)可視化分析案例

python實現(xiàn)股票歷史數(shù)據(jù)可視化分析案例

熱門標簽:海外網(wǎng)吧地圖標注注冊 ai電銷機器人的優(yōu)勢 孝感營銷電話機器人效果怎么樣 聊城語音外呼系統(tǒng) 地圖標注自己和別人標注區(qū)別 打電話機器人營銷 商家地圖標注海報 南陽打電話機器人 騰訊地圖標注沒法顯示

投資有風險,選擇需謹慎。 股票交易數(shù)據(jù)分析可直觀股市走向,對于如何把握股票行情,快速解讀股票交易數(shù)據(jù)有不可替代的作用!

1 數(shù)據(jù)預處理

1.1 股票歷史數(shù)據(jù)csv文件讀取

import pandas as pd
import csv
df = pd.read_csv("/home/kesci/input/maotai4154/maotai.csv")

1.2 關(guān)鍵數(shù)據(jù)——在csv文件中選擇性提取“列”

df_high_low = df[['date','high','low']]

1.3 數(shù)據(jù)類型轉(zhuǎn)換

df_high_low_array = np.array(df_high_low)
df_high_low_list =df_high_low_array.tolist()

1.4 數(shù)據(jù)按列提取并累加性存入列表

price_dates, heigh_prices, low_prices = [], [], []
for content in zip(df_high_low_list):
    price_date = content[0][0]
    heigh_price = content[0][1]
    low_price = content[0][2]
    price_dates.append(price_date)
    heigh_prices.append(heigh_price)
    low_prices.append(low_price)

 


2 pyecharts實現(xiàn)數(shù)據(jù)可視化

2.1 導入庫

import pyecharts.options as opts
from pyecharts.charts import Line

2.2 初始化畫布

Line(init_opts=opts.InitOpts(width="1200px", height="600px"))

2.3 根據(jù)需要傳入關(guān)鍵性數(shù)據(jù)并畫圖

    .add_yaxis(
        series_name="最低價",
        y_axis=low_prices,
        markpoint_opts=opts.MarkPointOpts(
            data=[opts.MarkPointItem(value=-2, name="周最低", x=1, y=-1.5)]
        ),
        markline_opts=opts.MarkLineOpts(
            data=[
                opts.MarkLineItem(type_="average", name="平均值"),
                opts.MarkLineItem(symbol="none", x="90%", y="max"),
                opts.MarkLineItem(symbol="circle", type_="max", name="最高點"),
            ]
        ),
    )
tooltip_opts=opts.TooltipOpts(trigger="axis"),
toolbox_opts=opts.ToolboxOpts(is_show=True),
xaxis_opts=opts.AxisOpts(type_="category", boundary_gap=True)

2.4 將生成的文件形成HTML代碼并下載

.render("HTML名字填這里.html")

2.5 完整代碼展示

import pyecharts.options as opts
from pyecharts.charts import Line
 
(
    Line(init_opts=opts.InitOpts(width="1200px", height="600px"))
    .add_xaxis(xaxis_data=price_dates)
    .add_yaxis(
        series_name="最高價",
        y_axis=heigh_prices,
        markpoint_opts=opts.MarkPointOpts(
            data=[
                opts.MarkPointItem(type_="max", name="最大值"),
                opts.MarkPointItem(type_="min", name="最小值"),
            ]
        ),
        markline_opts=opts.MarkLineOpts(
            data=[opts.MarkLineItem(type_="average", name="平均值")]
        ),
    )
    .add_yaxis(
        series_name="最低價",
        y_axis=low_prices,
        markpoint_opts=opts.MarkPointOpts(
            data=[opts.MarkPointItem(value=-2, name="周最低", x=1, y=-1.5)]
        ),
        markline_opts=opts.MarkLineOpts(
            data=[
                opts.MarkLineItem(type_="average", name="平均值"),
                opts.MarkLineItem(symbol="none", x="90%", y="max"),
                opts.MarkLineItem(symbol="circle", type_="max", name="最高點"),
            ]
        ),
    )
    .set_global_opts(
        title_opts=opts.TitleOpts(title="茅臺股票歷史數(shù)據(jù)可視化", subtitle="日期、最高價、最低價可視化"),
        tooltip_opts=opts.TooltipOpts(trigger="axis"),
        toolbox_opts=opts.ToolboxOpts(is_show=True),
        xaxis_opts=opts.AxisOpts(type_="category", boundary_gap=True),
    )
    .render("everyDayPrice_change_line_chart2.html")
)

3 結(jié)果展示

到此這篇關(guān)于python實現(xiàn)股票歷史數(shù)據(jù)可視化分析案例的文章就介紹到這了,更多相關(guān)python股票數(shù)據(jù)可視化內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • 利用Python進行數(shù)據(jù)可視化的實例代碼
  • python數(shù)據(jù)可視化之matplotlib.pyplot基礎(chǔ)以及折線圖
  • 淺談哪個Python庫才最適合做數(shù)據(jù)可視化
  • python數(shù)據(jù)可視化plt庫實例詳解
  • 學會Python數(shù)據(jù)可視化必須嘗試這7個庫
  • Python中seaborn庫之countplot的數(shù)據(jù)可視化使用
  • Python數(shù)據(jù)可視化之基于pyecharts實現(xiàn)的地理圖表的繪制
  • Python爬蟲實戰(zhàn)之爬取京東商品數(shù)據(jù)并實實現(xiàn)數(shù)據(jù)可視化
  • Python數(shù)據(jù)可視化之用Matplotlib繪制常用圖形
  • Python數(shù)據(jù)可視化之繪制柱狀圖和條形圖
  • python用pyecharts實現(xiàn)地圖數(shù)據(jù)可視化
  • python數(shù)據(jù)可視化 – 利用Bokeh和Bottle.py在網(wǎng)頁上展示你的數(shù)據(jù)

標簽:撫州 揚州 迪慶 牡丹江 楊凌 聊城 南寧 六盤水

巨人網(wǎng)絡(luò)通訊聲明:本文標題《python實現(xiàn)股票歷史數(shù)據(jù)可視化分析案例》,本文關(guān)鍵詞  python,實現(xiàn),股票,歷史數(shù)據(jù),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《python實現(xiàn)股票歷史數(shù)據(jù)可視化分析案例》相關(guān)的同類信息!
  • 本頁收集關(guān)于python實現(xiàn)股票歷史數(shù)據(jù)可視化分析案例的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 连云港市| 伊吾县| 天镇县| 额济纳旗| 金阳县| 那曲县| 中卫市| 新宾| 甘谷县| 库车县| 寿光市| 波密县| 镇巴县| 屯留县| 虞城县| 惠水县| 临高县| 溧水县| 安宁市| 贵州省| 桐柏县| 抚州市| 曲松县| 加查县| 沙湾县| 铜川市| 云南省| 凭祥市| 武邑县| 文昌市| 湄潭县| 阿拉善左旗| 海林市| 定远县| 沧源| 尚志市| 咸丰县| 汉川市| 迭部县| 上林县| 大竹县|