class_docstr: Stores draws from one or more chains.
  
  Returned by methods of a ``Model``. Users will not instantiate this class directly.
  
  A `Fit` instance works like a Python dictionary. A user-friendly views of draws
  is available via ``to_frame``.
docstr: Return view of draws as a pandas DataFrame.
  
  If pandas is not installed, a `RuntimeError` will be raised.
  
  Returns:
      pandas.DataFrame: DataFrame with `num_draws` rows and
          `num_flat_params` columns.
docstr_tok: ["Return","view","of","draws","as","a","pandas","DataFrame",".","If","pandas","is","not","installed",",","a","`","RuntimeError","`","will","be","raised",".","Returns",":","pandas.DataFrame",":","DataFrame","with","`","num_draws","`","rows","and","`","num_flat_params","`","columns","."]
code: def to_frame(self):
      """Return view of draws as a pandas DataFrame.
  
      If pandas is not installed, a `RuntimeError` will be raised.
  
      Returns:
          pandas.DataFrame: DataFrame with `num_draws` rows and
              `num_flat_params` columns.
      """
      try:
          import pandas as pd
      except ImportError:
          raise RuntimeError(
              "The `to_frame` method requires the Python package `pandas`."
          )
      columns = (
          self.sample_and_sampler_param_names
          + self.constrained_param_names
      )
      assert len(self._draws) == len(columns)
      df = pd.DataFrame(
          self._draws.reshape(len(columns), -1).T, columns=columns
      )
      df.index.name, df.columns.name = "draws", "parameters"
      return df
  
file_path: pystan/stan/fit.py
imports: import collections
  import json
  from math import ceil
  from typing import Generator, Tuple, cast
  import numpy
  import simdjson
label_desc: Use image node_id 3 for calling the Fit obj's underlying member method code with example usage: obj.to_frame() and returns: df