code: def data2dummy(x, returnall=False):
      """convert array of categories to dummy variables
      by default drops dummy variable for last category
      uses ravel, 1d only"""
      x = x.ravel()
      groups = np.unique(x)
      if returnall:
          return (x[:, None] == groups).astype(int)
      else:
          return (x[:, None] == groups).astype(int)[:, :-1]
  
file_path: statsmodels/statsmodels/sandbox/regression/ols_anova_original.py
imports: import numpy
  import numpy.lib.recfunctions
  from statsmodels.compat.python import lmap
  from statsmodels.regression.linear_model import OLS
label_desc: Use image node_id 1 for calling a global function with example usage: data2dummy(x, returnall) and returns: unknown, unknown