I would like to loop over a file where there is an date index and values. Looping backward would help to prevent checking a date where there is no data. So it should stop as it find the first date. I set a today date, change into the appropriate format that correspond to the date in the file, try to loc the data and change the date to previous day if no data found. I think a while look is good for that. The logic seems ok but the code does not work. Any help would be appreciated. My code is:
fiat_balance = []
today = datetime.today()
while False:
date = today.strftime('%m/%d/%Y')
date = date+' 10:30:00'
fiat_balance = pd.concat([cp.loc[date],pt.loc[date]], axis=0, keys=[2,3]).fillna(0)
today-= timedelta(days=1)