code: def _where(
      df_or_series,
      cond,
      other=np.nan,
      inplace=False,
      axis=None,
      level=None,
      errors="raise",
      try_cast=False,
      replace_true=False,
  ):
      if (
          df_or_series.ndim == 2
          and getattr(other, "ndim", 2) == 1
          and axis is None
      ):
          raise ValueError("Must specify axis=0 or 1")
  
      axis = validate_axis(axis or 0, df_or_series)
      op = DataFrameWhere(
          cond=cond,
          other=other,
          axis=axis,
          level=level,
          errors=errors,
          try_cast=try_cast,
          replace_true=replace_true,
      )
      result = op(df_or_series)
      if inplace:
          df_or_series.data = result.data
      else:
          return result
  
imports: import numpy
  import pandas
  from ...None import opcodes
  from ...core import ENTITY_TYPE, recursive_tile
  from ...serialization.serializables import AnyField, Int32Field, BoolField, StringField
  from ...tensor.utils import filter_inputs
  from ..core import DATAFRAME_TYPE, SERIES_TYPE
  from ..operands import DataFrameOperandMixin, DataFrameOperand
  from ..utils import build_df, build_series, validate_axis
label_desc: Use image node_id 1 for calling a global function with example usage: _where(df_or_series, cond, other, inplace, axis, level, errors, try_cast, replace_true) and returns: result