class_docstr: Pandas ExtensionArray to represent ragged arrays
  
  Methods not otherwise documented here are inherited from ExtensionArray;
  please see the corresponding method on that class for the docstring
class_docstr_tok: ["Pandas","ExtensionArray","to","represent","ragged","arrays","Methods","not","otherwise","documented","here","are","inherited","from","ExtensionArray",";","please","see","the","corresponding","method","on","that","class","for","the","docstring"]
docstr: Construct a RaggedArray
  
  Parameters
  ----------
  data: list or array or dict or RaggedArray
      * list or 1D-array: A List or 1D array of lists or 1D arrays that
                          should be represented by the RaggedArray
  
      * dict: A dict containing 'start_indices' and 'flat_array' keys
              with numpy array values where:
              - flat_array:  numpy array containing concatenation
                             of all nested arrays to be represented
                             by this ragged array
              - start_indices: unsigned integer numpy array the same
                               length as the ragged array where values
                               represent the index into flat_array where
                               the corresponding ragged array element
                               begins
      * RaggedArray: A RaggedArray instance to copy
  
  dtype: RaggedDtype or np.dtype or str or None (default None)
      Datatype to use to store underlying values from data.
      If none (the default) then dtype will be determined using the
      numpy.result_type function.
  copy : bool (default False)
      Whether to deep copy the input arrays. Only relevant when `data`
      has type `dict` or `RaggedArray`. When data is a `list` or
      `array`, input arrays are always copied.
code: def __init__(self, data, dtype=None, copy=False):
      """
      Construct a RaggedArray
  
      Parameters
      ----------
      data: list or array or dict or RaggedArray
          * list or 1D-array: A List or 1D array of lists or 1D arrays that
                              should be represented by the RaggedArray
  
          * dict: A dict containing 'start_indices' and 'flat_array' keys
                  with numpy array values where:
                  - flat_array:  numpy array containing concatenation
                                 of all nested arrays to be represented
                                 by this ragged array
                  - start_indices: unsigned integer numpy array the same
                                   length as the ragged array where values
                                   represent the index into flat_array where
                                   the corresponding ragged array element
                                   begins
          * RaggedArray: A RaggedArray instance to copy
  
      dtype: RaggedDtype or np.dtype or str or None (default None)
          Datatype to use to store underlying values from data.
          If none (the default) then dtype will be determined using the
          numpy.result_type function.
      copy : bool (default False)
          Whether to deep copy the input arrays. Only relevant when `data`
          has type `dict` or `RaggedArray`. When data is a `list` or
          `array`, input arrays are always copied.
      """
      if isinstance(data, dict) and all(
          k in data for k in ["start_indices", "flat_array"]
      ):
          _validate_ragged_properties(
              start_indices=data["start_indices"],
              flat_array=data["flat_array"],
          )
  
          self._start_indices = data["start_indices"]
          self._flat_array = data["flat_array"]
          dtype = self._flat_array.dtype
  
          if copy:
              self._start_indices = self._start_indices.copy()
              self._flat_array = self._flat_array.copy()
  
      elif isinstance(data, RaggedArray):
          self._flat_array = data.flat_array
          self._start_indices = data.start_indices
          dtype = self._flat_array.dtype
  
          if copy:
              self._start_indices = self._start_indices.copy()
              self._flat_array = self._flat_array.copy()
      else:
          # Compute lengths
          index_len = len(data)
          buffer_len = sum(
              len(datum) if not missing(datum) else 0 for datum in data
          )
  
          # Compute necessary precision of start_indices array
          for nbits in [8, 16, 32, 64]:
              start_indices_dtype = "uint" + str(nbits)
              max_supported = np.iinfo(start_indices_dtype).max
              if buffer_len <= max_supported:
                  break
  
          # infer dtype if not provided
          if dtype is None:
              non_missing = [
                  np.atleast_1d(v) for v in data if not missing(v)
              ]
              if non_missing:
                  dtype = np.result_type(*non_missing)
              else:
                  dtype = "float64"
          elif isinstance(dtype, RaggedDtype):
              dtype = dtype.subtype
  
          # Initialize representation arrays
          self._start_indices = np.zeros(
              index_len, dtype=start_indices_dtype
          )
          self._flat_array = np.zeros(buffer_len, dtype=dtype)
  
          # Populate arrays
          next_start_ind = 0
          for i, array_el in enumerate(data):
              # Compute element length
              n = len(array_el) if not missing(array_el) else 0
  
              # Update start indices
              self._start_indices[i] = next_start_ind
  
              # Do not assign when slice is empty avoiding possible
              # nan assignment to integer array
              if not n:
                  continue
  
              # Update flat array
              self._flat_array[
                  next_start_ind : next_start_ind + n
              ] = array_el
  
              # increment next start index
              next_start_ind += n
  
      self._dtype = RaggedDtype(dtype=dtype)
  
imports: from __future__ import annotations
  import re
  from functools import total_ordering
  from packaging.version import Version
  import numpy
  import pandas
  from numba import jit
  from pandas.api.extensions import ExtensionDtype, ExtensionArray, register_extension_dtype
  from numbers import Integral
  from pandas.api.types import pandas_dtype, is_extension_array_dtype
label_desc: Use image node_id 1 to create a new RaggedArray object from inherited base classes: ExtensionArray with example: obj = RaggedArray(data, dtype, copy)