Concatinate to pandas data frame from OrderedDict - Python equivalent to R´s do.call(merge, list)
Question: I have an ordered dictionary `"my_dict`", which gets filled with `n` time
series during a loop. All `n` time series have the same length and are
1-dimensional. They all have a datetime index.

In R I just run `do.call(merge, my_dict)`, where `my_dict` is a `list()` and I
obtain an `m x n xts` object with a single index.

In Python however `pandas.concat(my_dict, axis = 1)` returns a single indexed
dataframe (which is good) but all columns from the seconds column on are NaNs.
Whats the correct command?


Answer: A `pandas.DataFrame` can be constructed directly from a dictionary so all you
need to do is pass `my_dict` to the `pandas.DataFrame` constructor (i.e.,
`pandas.DataFrame(my_dict)`). For example:

    
    
    import pandas
    from collections import OrderedDict
    import numpy as np
    
    m = 10
    n = 5
    
    index = pandas.date_range('1/1/2015', periods=m, freq='D')
    my_dict = OrderedDict()
    
    for i in range(1, n+1):
        my_dict['var_%d' % i] = pandas.Series(np.random.randn(index.shape[0]), index=index)
    
    print(pandas.DataFrame(my_dict))
    
                   var_1     var_2     var_3     var_4     var_5
    2015-01-01  0.562952  0.708099  0.488981 -1.360356 -0.036179
    2015-01-02 -0.481410  0.604777  0.233426 -0.784103  1.879795
    2015-01-03  1.188333  0.299547 -0.578365  0.882410  0.919328
    2015-01-04 -1.002273  0.794856 -0.527205  1.474524 -0.798646
    2015-01-05 -0.025225  2.246476 -0.460735  0.272014 -0.061749
    2015-01-06 -1.304233  1.204737  0.040275  0.293035  0.831555
    2015-01-07 -0.934804  0.922393  0.633133  1.064837 -0.154307
    2015-01-08  0.440650  0.235624  0.765399  0.306628 -0.274465
    2015-01-09  1.637787 -0.158231 -0.643112 -1.128660  0.393349
    2015-01-10  0.145501 -0.667916  1.094961 -1.669178  0.447021
    

