for i in stk_info_df.index: try: print('processing: ' + i) info_dict = yf.Ticker(i).info columns_included = list(info_dict.keys()) #print(columns_included) intersect_columns = [x for x in info_columns if x in columns_included] #print(intersect_columns) stk_info_df.loc[i,intersect_columns] = list(pd.Series(info_dict)[intersect_columns].values) tm.sleep(2) except: failed_list.append(i) continue print(failed_list) stk_info_df.to_csv('sp500.csv')