I have created a data frame df1 like below,
data = {'ID':[1,2,3,4,5,6,7,8,9,10],
        'date_1':['2021-03-01','2021-03-02','2021-04-03','2021-03-04','2021-03-05','2021-03-06','2021-03-07','2021-03-08','2021-03-09','2021-03-10'],
        'date_2': ['2021-03-06','2021-03-07','2021-03-08','2021-03-09','2021-03-10','2021-03-11','2021-03-12','2021-03-13','2021-03-14','2021-03-15']
       }
df1 = pd.DataFrame(data, columns = ['ID','date_1','date_2'])
df1
I am trying to create a new dataframe df2 with just one column 'date_3' from df1. The column 'date_3' in df2 ideally should be returning just the rows(dates) from df1 which meet the condition of the below statement (True),
df1['date_1'] <= df1['date_2']
Below is my approach but I am just getting the conditional output (True/False) and the not the actual date values,
data = [df1['date_1'] <= df1['date_2']]
headers = ['date_3']
df2 = pd.concat(data, axis=1, keys=headers)
df2



df[df['date_1'] <= df['date_2']]dateyou want to show indate_3?date_1ordate_2?df2 = df1.loc[df1['date_1'] <= df1['date_2'], ['date_1']]