code: def pivot_wider(
      df: pd.DataFrame,
      index: Optional[Union[list, str]] = None,
      names_from: Optional[Union[list, str]] = None,
      values_from: Optional[Union[list, str]] = None,
      flatten_levels: Optional[bool] = True,
      names_sep: str = "_",
      names_glue: str = None,
      reset_index: bool = True,
      names_expand: bool = False,
      index_expand: bool = False,
  ) -> pd.DataFrame:
      """Reshapes data from *long* to *wide* form.
  
      !!!note
  
          This function will be deprecated in a 1.x release.
          Please use `pd.DataFrame.pivot` instead.
  
      The number of columns are increased, while decreasing
      the number of rows. It is the inverse of the
      [`pivot_longer`][janitor.functions.pivot.pivot_longer]
      method, and is a wrapper around `pd.DataFrame.pivot` method.
  
      This method does not mutate the original DataFrame.
  
      Column selection in `index`, `names_from` and `values_from`
      is possible using the
      [`select`][janitor.functions.select.select] syntax.
  
      A ValueError is raised if the combination
      of the `index` and `names_from` is not unique.
  
      By default, values from `values_from` are always
      at the top level if the columns are not flattened.
      If flattened, the values from `values_from` are usually
      at the start of each label in the columns.
  
      Examples:
          >>> import pandas as pd
          >>> import janitor
          >>> df = [{'dep': 5.5, 'step': 1, 'a': 20, 'b': 30},
          ...       {'dep': 5.5, 'step': 2, 'a': 25, 'b': 37},
          ...       {'dep': 6.1, 'step': 1, 'a': 22, 'b': 19},
          ...       {'dep': 6.1, 'step': 2, 'a': 18, 'b': 29}]
          >>> df = pd.DataFrame(df)
          >>> df
             dep  step   a   b
          0  5.5     1  20  30
          1  5.5     2  25  37
          2  6.1     1  22  19
          3  6.1     2  18  29
  
          Pivot and flatten columns:
          >>> df.pivot_wider( # doctest: +SKIP
          ...     index = "dep",
          ...     names_from = "step",
          ... )
             dep  a_1  a_2  b_1  b_2
          0  5.5   20   25   30   37
          1  6.1   22   18   19   29
  
          Modify columns with `names_sep`:
          >>> df.pivot_wider( # doctest: +SKIP
          ...     index = "dep",
          ...     names_from = "step",
          ...     names_sep = "",
          ... )
             dep  a1  a2  b1  b2
          0  5.5  20  25  30  37
          1  6.1  22  18  19  29
  
          Modify columns with `names_glue`:
          >>> df.pivot_wider( # doctest: +SKIP
          ...     index = "dep",
          ...     names_from = "step",
          ...     names_glue = "{_value}_step{step}",
          ... )
             dep  a_step1  a_step2  b_step1  b_step2
          0  5.5       20       25       30       37
          1  6.1       22       18       19       29
  
          Expand columns to expose implicit missing values
          - this applies only to categorical columns:
          >>> weekdays = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
          >>> daily = pd.DataFrame(
          ...     {
          ...         "day": pd.Categorical(
          ...             values=("Tue", "Thu", "Fri", "Mon"), categories=weekdays
          ...         ),
          ...         "value": (2, 3, 1, 5),
          ...     },
          ... index=[0, 0, 0, 0],
          ... )
          >>> daily
             day  value
          0  Tue      2
          0  Thu      3
          0  Fri      1
          0  Mon      5
          >>> daily.pivot_wider(names_from='day', values_from='value') # doctest: +SKIP
             Tue  Thu  Fri  Mon
          0    2    3    1    5
          >>> (daily # doctest: +SKIP
          ... .pivot_wider(
          ...     names_from='day',
          ...     values_from='value',
          ...     names_expand=True)
          ... )
             Mon  Tue  Wed  Thu  Fri  Sat  Sun
          0    5    2  NaN    3    1  NaN  NaN
  
          Expand the index to expose implicit missing values
          - this applies only to categorical columns:
          >>> daily = daily.assign(letter = list('ABBA'))
          >>> daily
             day  value letter
          0  Tue      2      A
          0  Thu      3      B
          0  Fri      1      B
          0  Mon      5      A
          >>> daily.pivot_wider(index='day',names_from='letter',values_from='value') # doctest: +SKIP
             day    A    B
          0  Tue  2.0  NaN
          1  Thu  NaN  3.0
          2  Fri  NaN  1.0
          3  Mon  5.0  NaN
          >>> (daily # doctest: +SKIP
          ... .pivot_wider(
          ...     index='day',
          ...     names_from='letter',
          ...     values_from='value',
          ...     index_expand=True)
          ... )
             day    A    B
          0  Mon  5.0  NaN
          1  Tue  2.0  NaN
          2  Wed  NaN  NaN
          3  Thu  NaN  3.0
          4  Fri  NaN  1.0
          5  Sat  NaN  NaN
          6  Sun  NaN  NaN
  
  
      !!! abstract "Version Changed"
  
          - 0.24.0
              - Added `reset_index`, `names_expand` and `index_expand` parameters.
  
      Args:
          df: A pandas DataFrame.
          index: Name(s) of columns to use as identifier variables.
              It should be either a single column name, or a list of column names.
              If `index` is not provided, the DataFrame's index is used.
          names_from: Name(s) of column(s) to use to make the new
              DataFrame's columns. Should be either a single column name,
              or a list of column names.
          values_from: Name(s) of column(s) that will be used for populating
              the new DataFrame's values.
              If `values_from` is not specified,  all remaining columns
              will be used.
          flatten_levels: If `False`, the DataFrame stays as a MultiIndex.
          names_sep: If `names_from` or `values_from` contain multiple
              variables, this will be used to join the values into a single string
              to use as a column name. Default is `_`.
              Applicable only if `flatten_levels` is `True`.
          names_glue: A string to control the output of the flattened columns.
              It offers more flexibility in creating custom column names,
              and uses python's `str.format_map` under the hood.
              Simply create the string template,
              using the column labels in `names_from`,
              and special `_value` as a placeholder for `values_from`.
              Applicable only if `flatten_levels` is `True`.
          reset_index: Determines whether to restore `index`
              as a column/columns. Applicable only if `index` is provided,
              and `flatten_levels` is `True`.
          names_expand: Expand columns to show all the categories.
              Applies only if `names_from` is a categorical column.
          index_expand: Expand the index to show all the categories.
              Applies only if `index` is a categorical column.
  
      Returns:
          A pandas DataFrame that has been unpivoted from long to wide form.
      """  # noqa: E501
  
      # no need for an explicit copy --> df = df.copy()
      # `pd.pivot` creates one
      return _computations_pivot_wider(
          df,
          index,
          names_from,
          values_from,
          flatten_levels,
          names_sep,
          names_glue,
          reset_index,
          names_expand,
          index_expand,
      )
  
imports: import re
  import warnings
  from collections import defaultdict
  from itertools import chain, zip_longest
  from typing import Callable, Optional, Pattern, Union
  import numpy
  import pandas
  import pandas_flavor
  from pandas.api.types import is_categorical_dtype, is_extension_array_dtype, is_list_like
  from pandas.core.dtypes.concat import concat_compat
  from janitor.functions.utils import _computations_expand_grid, get_index_labels
  from janitor.utils import check, refactored_function
label_desc: Use image node_id 12 for calling a global function with example usage: pivot_wider(df, index, names_from, values_from, flatten_levels, names_sep, names_glue, reset_index, names_expand, index_expand) and returns: _computations_pivot_wider