Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random Dataframes

Tags:

python

pandas

I often find myself in need of creating random (fake) DataFrames, multi-index Dataframes and Series, with columns including dates, numbers and strings.

Does Pandas provide a mechanism to generate random DataFrames? Or are there any particular packages that can facilitate this task?

like image 620
Amelio Vazquez-Reina Avatar asked Dec 31 '25 02:12

Amelio Vazquez-Reina


1 Answers

maybe market data?

>>> 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]
like image 55
behzad.nouri Avatar answered Jan 02 '26 16:01

behzad.nouri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!