def write_all(self):
    for episode_type in self.episodes.keys():
        with open(os.path.join(self.log_path, '{}.csv'.format(episode_type)), mode='a') as result_file:
            writer = csv.writer(result_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
            for (i, episode) in enumerate(self.episodes[episode_type]):
                if (episode is not None):
                    if ('eval' in episode.name):
                        try:
                            episode.save(self.log_path)
                        except:
                            logger.info('Saving state evolution failed')
                    writer.writerow(episode.csv())
                    self.episodes[episode_type][i] = None
def write_all(self):
    for episode_type in self.episodes.keys():
        with open(os.path.join(self.log_path, '{}.csv'.format(episode_type)), mode='a') as result_file:
            writer = csv.writer(result_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
            for (i, episode) in enumerate(self.episodes[episode_type]):
                if (episode is not None):
                    if ('eval' in episode.name):
                        try:
                            episode.save(self.log_path)
                        except:
                            logger.info('Saving state evolution failed')
                    writer.writerow(episode.csv())
                    self.episodes[episode_type][i] = None