class_docstr: Dump all episode metrics to a ``result.csv``.
  
  This is not the correct implementation. It's only used for first iteration.
class_docstr_tok: ["Dump","all","episode","metrics","to","a","``","result.csv","``",".","This","is","not","the","correct","implementation",".","It","'s","only","used","for","first","iteration","."]
code: def log_episode(
      self,
      length: int,
      rewards: List[float],
      contents: List[Dict[str, Any]],
  ) -> None:
      # FIXME Same as ConsoleLogger, needs a refactor to eliminate code-dup
      episode_wise_contents: Dict[str, list] = defaultdict(list)
  
      for step_contents in contents:
          for name, value in step_contents.items():
              if isinstance(value, self.SUPPORTED_TYPES):
                  episode_wise_contents[name].append(value)
  
      logs: Dict[str, float] = {}
      for name, values in episode_wise_contents.items():
          logs[name] = self.aggregation(values, name)  # type: ignore
  
      self.all_records.append(logs)
  
imports: from __future__ import annotations
  import logging
  from collections import defaultdict
  from enum import IntEnum
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Callable, Dict, Generic, List, Sequence, Set, Tuple, TypeVar
  import numpy
  import pandas
  from qlib.log import get_module_logger
label_desc: Use image node_id 3 for calling the CsvWriter obj's underlying member method code with example usage: obj.log_episode(length, rewards, contents) without return types