code: def construct_1d_arraylike_from_scalar(value, length, dtype):
      """
      create a np.ndarray / pandas type of specified shape and dtype
      filled with values
  
      Parameters
      ----------
      value : scalar value
      length : int
      dtype : pandas_dtype / np.dtype
  
      Returns
      -------
      np.ndarray / pandas type of length, filled with value
  
      """
      if is_datetime64tz_dtype(dtype):
          from pandas import DatetimeIndex
  
          subarr = DatetimeIndex([value] * length, dtype=dtype)
      elif is_categorical_dtype(dtype):
          from pandas import Categorical
  
          subarr = Categorical([value] * length, dtype=dtype)
      else:
          if not isinstance(dtype, (np.dtype, type(np.dtype))):
              dtype = dtype.dtype
  
          if length and is_integer_dtype(dtype) and isna(value):
              # coerce if we have nan for an integer dtype
              dtype = np.dtype("float64")
          elif isinstance(dtype, np.dtype) and dtype.kind in ("U", "S"):
              # we need to coerce to object dtype to avoid
              # to allow numpy to take our string as a scalar value
              dtype = object
              if not isna(value):
                  value = to_str(value)
  
          subarr = np.empty(length, dtype=dtype)
          subarr.fill(value)
  
      return subarr
  
imports: from datetime import datetime, timedelta
  import numpy
  from pandas._libs import lib, tslib, tslibs
  from pandas._libs.tslibs import NaT, OutOfBoundsDatetime, Period, iNaT
  from pandas.compat import PY3, string_types, text_type, to_str
  from .common import _INT64_DTYPE, _NS_DTYPE, _POSSIBLY_CAST_DTYPES, _TD_DTYPE, ensure_int8, ensure_int16, ensure_int32, ensure_int64, ensure_object, is_bool, is_bool_dtype, is_categorical_dtype, is_complex, is_complex_dtype, is_datetime64_dtype, is_datetime64_ns_dtype, is_datetime64tz_dtype, is_datetime_or_timedelta_dtype, is_datetimelike, is_dtype_equal, is_extension_array_dtype, is_extension_type, is_float, is_float_dtype, is_integer, is_integer_dtype, is_object_dtype, is_scalar, is_string_dtype, is_timedelta64_dtype, is_timedelta64_ns_dtype, is_unsigned_integer_dtype, pandas_dtype
  from .dtypes import DatetimeTZDtype, ExtensionDtype, PandasExtensionDtype, PeriodDtype
  from .generic import ABCDatetimeArray, ABCDatetimeIndex, ABCPeriodArray, ABCPeriodIndex, ABCSeries
  from .inference import is_list_like
  from .missing import isna, notna
label_desc: Use image node_id 23 for calling a global function with example usage: construct_1d_arraylike_from_scalar(value, length, dtype) and returns: subarr