code: def pandas_friendly_reshape(a, new_shape):
      if not have_pandas:
          return a.reshape(new_shape)
      if not isinstance(a, pandas.DataFrame):
          return a.reshape(new_shape)
      # we have a DataFrame. Only supported reshapes are no-op, and
      # single-column DataFrame -> Series.
      if new_shape == a.shape:
          return a
      if len(new_shape) == 1 and a.shape[1] == 1:
          if new_shape[0] != a.shape[0]:
              raise ValueError("arrays have incompatible sizes")
          return a[a.columns[0]]
      raise ValueError(
          "cannot reshape a DataFrame with shape %s to shape %s"
          % (a.shape, new_shape)
      )
  
imports: import sys
  import numpy
  import six
  from six.moves import cStringIO
  from .compat import optional_dep_ok
label_desc: Use image node_id 5 for calling a global function with example usage: pandas_friendly_reshape(a, new_shape) and returns: a, a, a, a