align rows by date in pandas dataframe
<p>An excerpt of the Dateframe could look like this (it's certainly much larger):</p>

<pre><code>            Date1        Log1     Date2     Log2    Date3       Log3   
 Index
   0       01.01.2000    1000   02.01.2000  2000   01.01.2000   3000
   1       02.01.2000    1050   03.01.2000  1950   02.01.2000   3020
   2       03.01.2000    1100   04.01.2000  2000   03.01.2000   3000
</code></pre>

<p>Is there a quick way to align the rows so that the dates (here in Columns <code>Date3</code> and <code>Log3</code>) match with those in column <code>Date1</code>?</p>

<pre><code>            Date1        Log1     Date2     Log2    Date3       Log3   
 Index
   0       01.01.2000    1000   NaN                01.01.2000   3000
   1       02.01.2000    1050   02.01.2000  2000   02.01.2000   3020
   2       03.01.2000    1100   03.01.2000  1950   03.01.2000   3000
</code></pre>

<p>Many thanks in advance</p>

<p>Solution with <code>list comprehension</code> and <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.reindex.html" rel="nofollow"><code>reindex</code></a>, last <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.concat.html" rel="nofollow"><code>concat</code></a> all data together:</p>

<pre><code>dates = [col for col in df.columns if 'Date' in col]
logs = [col for col in df.columns if 'Log' in col]

print ([df[[col[0], col[1]]].set_index(col[0], drop=False)
                            .reindex(df.Date1) for col in zip(dates, logs)])

[                 Date1  Log1
Date1                       
01.01.2000  01.01.2000  1000
02.01.2000  02.01.2000  1050
03.01.2000  03.01.2000  1100,                  Date2    Log2
Date1                         
01.01.2000         NaN     NaN
02.01.2000  02.01.2000  2000.0
03.01.2000  03.01.2000  1950.0,                  Date3  Log3
Date1                       
01.01.2000  01.01.2000  3000
02.01.2000  02.01.2000  3020
03.01.2000  03.01.2000  3000]

df1 = pd.concat([df[[col[0], col[1]]]
        .set_index(col[0], drop=False)
        .reindex(df.Date1) for col in zip(dates, logs)], axis=1)

df1.reset_index(inplace=True, drop=True)

print (df1)
        Date1  Log1       Date2    Log2       Date3  Log3
0  01.01.2000  1000         NaN     NaN  01.01.2000  3000
1  02.01.2000  1050  02.01.2000  2000.0  02.01.2000  3020
2  03.01.2000  1100  03.01.2000  1950.0  03.01.2000  3000
</code></pre>

python pandas dataframe