OK, so sometimes I like to think of pandas DataFrames as nothing more than dictionaries. This is because working with dictionaries is so easy and thinking of them like simple dicts often means you can find a solution to an issue without having to get too deep into pandas.
So in your example, say, I would just create a list of common dates if the values of the DataFrames pass some value test, and then create a new data frame using those dates to access the values in the existing data frames. In my example the test is whether value 1 in DF1 + value2 in DF2 is greater than 10:
import pandas as pd
import random
random.seed(123)
#Create some data
DF1 = pd.DataFrame({'Date' : ['1990-03-17', '1990-03-18', '1990-03-19',
'1990-03-20', '1990-03-21', '1990-03-22',
'1990-03-23', '1990-03-24', '1990-03-25',
'1990-03-26', '1990-03-27', '1990-03-28',
'1990-03-29', '1990-03-30', '1990-03-31',
'1990-04-01', '1990-04-02', '1990-04-03'],
'Value1' : [round(random.uniform(1, 10), 2)
for x in xrange(18)],
'Value2' : [round(random.uniform(1, 10), 2)
for x in xrange(18)]
})
DF2 = pd.DataFrame({'Date' : ['1990-03-25', '1990-03-26', '1990-03-27',
'1990-03-28', '1990-03-29', '1990-03-30',
'1990-03-31', '1990-04-01', '1990-04-02',
'1990-04-03'],
'Value1' : [round(random.uniform(1, 10), 2)
for x in xrange(10)],
'Value2' : [round(random.uniform(1, 10), 2)
for x in xrange(10)]
})
DF1.set_index('Date', inplace = True)
DF2.set_index('Date', inplace = True)
#Create a list of common dates, where the values of DF1.Value1 summed
#with DF.Value2 is greater than 10
Common_Set = list(DF1.index.intersection(DF2.index))
Common_Dates = [date for date in Common_Set if
DF1.Value1[date] + DF2.Value1[date] > 10]
#And now create the data frame I think you want using the Common_Dates
DF_Output = pd.DataFrame({'L_Value1' : [DF1.Value1[date] for date in Common_Dates],
'L_Value2' : [DF1.Value2[date] for date in Common_Dates],
'S_Value1' : [DF2.Value1[date] for date in Common_Dates],
'S_Value2' : [DF2.Value2[date] for date in Common_Dates]
}, index = Common_Dates)
This is definitely do-able in pandas as the comment suggest, but to me this is a simple solution. The Common_Dates operations could easily be done in a one line, but I didn't for clarity.
Of course, it might be a massive pain to write out the DF_Output DataFrame constructor if you have lots of columns in both data frames. If that is the case then you could do this:
DF1_Out = {'L' + col : [DF1[col][date] for date in Common_Dates]
for col in DF1.columns}
DF2_Out = {'S' + col : [DF2[col][date] for date in Common_Dates]
for col in DF2.columns}
DF_Out = {}
DF_Out.update(DF1_Out)
DF_Out.update(DF2_Out)
DF_Output2 = pd.DataFrame(DF_Out, index = Common_Dates)
Both methods give me this:
LValue1 LValue2 SValue1 SValue2
1990-03-25 8.67 6.16 3.84 4.37
1990-03-27 4.03 8.54 7.92 7.79
1990-03-29 3.21 4.09 7.16 8.38
1990-03-31 4.93 2.86 7.00 6.92
1990-04-01 1.79 6.48 9.01 2.53
1990-04-02 6.38 5.74 5.38 4.03
This won't satisfy a lot of people I imagine, but it is the way I would tackle it. p.s. it would be great if you could do the leg work re: creating data frames in subsequent questions.