Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96264

Random Dataframes

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?

Upvotes: 3

Views: 112

Answers (1)

behzad.nouri
behzad.nouri

Reputation: 77941

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]

Upvotes: 3

Related Questions