code: def infer(cls, sample: dict, flatten_arrays=True):
      columns = []
      ndarray_columns = set()
  
      for name, value in sample.items():
          if isinstance(value, np.ndarray):
              if value.ndim > 1:
                  ndarray_columns.add(name)
  
          columns.append(name)
  
      return cls(
          columns=columns,
          ndarray_columns=ndarray_columns,
          flatten_arrays=flatten_arrays,
      )
  
imports: from dataclasses import dataclass, field
  from functools import partial, singledispatch
  from itertools import chain
  from pathlib import Path
  from typing import List, Set, Optional, Union
  from typing_extensions import Literal
  from toolz.curried import keyfilter, valmap
  import numpy
  import pandas
  import pyarrow
  import pyarrow.parquet
  from gluonts.dataset import Dataset, DatasetWriter
  from gluonts.itertools import batcher, rows_to_columns
label_desc: Use image node_id 1 for calling the ArrowEncoder obj's underlying member method code with example usage: obj.infer(cls, sample, flatten_arrays) and returns: cls