【数据分析与可视化】股票市场分析实战之历史趋势分析

Bliss ·
更新时间:2024-11-10
· 726 次阅读

# 基本信息 import numpy as np import pandas as pd from pandas import Series, DataFrame # 股票数据读取 import pandas_datareader as pdr # 可视化 import matplotlib.pyplot as plt import seaborn as sns #%matplotlib inline # time from datetime import datetime start = datetime(2015,9,20) # 获取阿里股票数据 alibaba = pdr.get_data_yahoo('BABA', start=start) # 获取亚马逊数据 amazon = pdr.get_components_yahoo('AMZN') # 数据存储alibaba.to_csv('url') # 读取本地数据 alibaba = pd.read_csv('/Users/bennyrhys/Desktop/数据分析可视化-数据集/homework/BABA.csv',index_col=0) amazon = pd.read_csv('/Users/bennyrhys/Desktop/数据分析可视化-数据集/homework/AMZN.csv',index_col=0) alibaba.head()
Open High Low Close Adj Close Volume
Date
2015-09-21 65.379997 66.400002 62.959999 63.900002 63.900002 22355100
2015-09-22 62.939999 63.270000 61.580002 61.900002 61.900002 14897900
2015-09-23 61.959999 62.299999 59.680000 60.000000 60.000000 22684600
2015-09-24 59.419998 60.340000 58.209999 59.919998 59.919998 20645700
2015-09-25 60.630001 60.840000 58.919998 59.240002 59.240002 17009100
amazon.head()
Open High Low Close Adj Close Volume
Date
2015-09-21 544.330017 549.780029 539.590027 548.390015 548.390015 3283300
2015-09-22 539.710022 543.549988 532.659973 538.400024 538.400024 3841700
2015-09-23 538.299988 541.210022 534.000000 536.070007 536.070007 2237600
2015-09-24 530.549988 534.559998 522.869995 533.750000 533.750000 3501000
2015-09-25 542.570007 542.799988 521.400024 524.250000 524.250000 4031000
# 闭盘走势 alibaba['Adj Close'].plot(legend=True)

原创文章 279获赞 320访问量 18万+ 关注 私信 展开阅读全文
作者:bennyrhys瑞新



市场分析 实战 数据 数据分析 股票 可视化

需要 登录 后方可回复, 如果你还没有账号请 注册新账号