docstr: Adds a `schema` attribute with the Table Schema, resets
  the index (can't do in caller, because the schema inference needs
  to know what the index is, forces orient to records, and forces
  date_format to 'iso'.
docstr_tok: ["Adds","a","`","schema","`","attribute","with","the","Table","Schema",",","resets","the","index","(","ca","n't","do","in","caller",",","because","the","schema","inference","needs","to","know","what","the","index","is",",","forces","orient","to","records",",","and","forces","date_format","to","'iso","'","."]
code: def __init__(
      self,
      obj,
      orient,
      date_format,
      double_precision,
      ensure_ascii,
      date_unit,
      index,
      default_handler=None,
  ):
      """
      Adds a `schema` attribute with the Table Schema, resets
      the index (can't do in caller, because the schema inference needs
      to know what the index is, forces orient to records, and forces
      date_format to 'iso'.
      """
      super(JSONTableWriter, self).__init__(
          obj,
          orient,
          date_format,
          double_precision,
          ensure_ascii,
          date_unit,
          index,
          default_handler=default_handler,
      )
  
      if date_format != "iso":
          msg = (
              "Trying to write with `orient='table'` and "
              "`date_format='{fmt}'`. Table Schema requires dates "
              "to be formatted with `date_format='iso'`".format(
                  fmt=date_format
              )
          )
          raise ValueError(msg)
  
      self.schema = build_table_schema(obj, index=self.index)
  
      # NotImplementd on a column MultiIndex
      if obj.ndim == 2 and isinstance(obj.columns, MultiIndex):
          raise NotImplementedError(
              "orient='table' is not supported for MultiIndex"
          )
  
      # TODO: Do this timedelta properly in objToJSON.c See GH #15137
      if (
          (obj.ndim == 1)
          and (obj.name in set(obj.index.names))
          or len(obj.columns & obj.index.names)
      ):
          msg = "Overlapping names between the index and columns"
          raise ValueError(msg)
  
      obj = obj.copy()
      timedeltas = obj.select_dtypes(include=["timedelta"]).columns
      if len(timedeltas):
          obj[timedeltas] = obj[timedeltas].applymap(
              lambda x: x.isoformat()
          )
      # Convert PeriodIndex to datetimes before serialzing
      if is_period_dtype(obj.index):
          obj.index = obj.index.to_timestamp()
  
      # exclude index from obj if index=False
      if not self.index:
          self.obj = obj.reset_index(drop=True)
      else:
          self.obj = obj.reset_index(drop=False)
      self.date_format = "iso"
      self.orient = "records"
      self.index = index
  
imports: from itertools import islice
  import os
  import numpy
  import pandas._libs.json
  from pandas._libs.tslibs import iNaT
  from pandas.compat import StringIO, long, to_str, u
  from pandas.errors import AbstractMethodError
  from pandas.core.dtypes.common import is_period_dtype
  from pandas import DataFrame, MultiIndex, Series, compat, isna, to_datetime
  from pandas.core.reshape.concat import concat
  from pandas.io.common import BaseIterator, _get_handle, _infer_compression, _stringify_path, get_filepath_or_buffer
  from pandas.io.formats.printing import pprint_thing
  from pandas.io.parsers import _validate_integer
  from .normalize import _convert_to_line_delimits
  from .table_schema import build_table_schema, parse_table_schema
label_desc: Use image node_id 1 to create a new JSONTableWriter object from inherited base classes: FrameWriter with example: obj = JSONTableWriter(obj, orient, date_format, double_precision, ensure_ascii, date_unit, index, default_handler)