gpt4 book ai didi

python - 随机数据帧

转载 作者:行者123 更新时间:2023-11-28 16:38:33 25 4
gpt4 key购买 nike

我经常发现自己需要创建随机(假)DataFrame、多索引 Dataframes 和系列,其中的列包括日期、数字和字符串。

Pandas 是否提供生成随机 DataFrame 的机制?或者是否有任何特定的软件包可以促进这项任务?

最佳答案

也许是市场数据?

>>> import pandas.io.data as web
>>> web.DataReader(["AAPL", "GOOG"], "yahoo", start='2014-03-26').to_frame()

Open High Low Close Volume Adj Close
Date minor
2014-03-26 AAPL 546.52 549.00 538.86 539.78 10706000 539.78
GOOG 1162.01 1171.57 1131.50 1131.97 2580000 1131.97
2014-03-27 AAPL 540.02 541.50 535.12 537.46 7929700 537.46
GOOG 1130.85 1131.94 1102.10 1114.28 3822200 1114.28
2014-03-28 AAPL 538.32 538.94 534.25 536.86 7106900 536.86
GOOG 1119.00 1133.19 1117.77 1120.15 2254700 1120.15
2014-03-31 AAPL 539.23 540.81 535.93 536.74 5972100 536.74
GOOG 1130.40 1135.00 1112.85 1114.51 1940500 1114.51

[8 rows x 6 columns]

关于python - 随机数据帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22794269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com