(func_params, series_params, df)
return func_text, global_vars
Example func_text for func_name='copy' columns=('A', 'B'):
        def _df_copy_impl(df, deep=True):
          data_0 = df._data[0][0]
          series_0 = pandas.Series(data_0, name='A')
          result_0 = series_0.copy(deep=deep)
          data_1 = df._data[1][0]
          series_1 = pandas.Series(data_1, name='B')
          result_1 = series_1.copy(deep=deep)
          return pandas.DataFrame({"A": result_0, "B": result_1}, index=df._index)
Example func_text for func_name='copy' columns=('A', 'B'):
        def _df_copy_impl(df, deep=True):
          data_0 = df._data[0][0]
          series_0 = pandas.Series(data_0, name='A')
          result_0 = series_0.copy(deep=deep)
          data_1 = df._data[1][0]
          series_1 = pandas.Series(data_1, name='B')
          result_1 = series_1.copy(deep=deep)
          return pandas.DataFrame({"A": result_0, "B": result_1}, index=df._index)
Example func_text for func_name = copy columns = ( A B ) : def _df_copy_impl ( df deep = True ) : data_0 = df . _data [ 0 ] [ 0 ] series_0 = pandas . Series ( data_0 name = A ) result_0 = series_0 . copy ( deep = deep ) data_1 = df . _data [ 1 ] [ 0 ] series_1 = pandas . Series ( data_1 name = B ) result_1 = series_1 . copy ( deep = deep ) return pandas . DataFrame ( { A : result_0 B : result_1 } index = df . _index )
def _dataframe_codegen_copy(func_params, series_params, df):
    """
    Example func_text for func_name='copy' columns=('A', 'B'):
        def _df_copy_impl(df, deep=True):
          data_0 = df._data[0][0]
          series_0 = pandas.Series(data_0, name='A')
          result_0 = series_0.copy(deep=deep)
          data_1 = df._data[1][0]
          series_1 = pandas.Series(data_1, name='B')
          result_1 = series_1.copy(deep=deep)
          return pandas.DataFrame({"A": result_0, "B": result_1}, index=df._index)
    """
    results = []
    series_params_str = ', '.join(kwsparams2list(series_params))
    func_params_str = ', '.join(kwsparams2list(func_params))
    func_lines = [f"def _df_copy_impl(df, {func_params_str}):"]
    index = 'df._index'
    for i, c in enumerate(df.columns):
        col_loc = df.column_loc[c]
        type_id, col_id = col_loc.type_id, col_loc.col_id
        result_c = f"result_{i}"
        func_lines += [f"  data_{i} = df._data[{type_id}][{col_id}]",
                       f"  series_{i} = pandas.Series(data_{i}, name='{c}')",
                       f"  {result_c} = series_{i}.copy({series_params_str})"]
        results.append((c, result_c))

    data = ', '.join(f'"{col}": {data}' for col, data in results)
    func_lines += [f"  return pandas.DataFrame({{{data}}}, {index})"]
    func_text = '\n'.join(func_lines)
    global_vars = {'pandas': pandas}

    return func_text, global_vars
def _dataframe_codegen_copy ( func_params , series_params , df ) : results = [ ] series_params_str = ', ' . join ( kwsparams2list ( series_params ) ) func_params_str = ', ' . join ( kwsparams2list ( func_params ) ) func_lines = [ f"def _df_copy_impl(df, {func_params_str}):" ] index = 'df._index' for i , c in enumerate ( df . columns ) : col_loc = df . column_loc [ c ] type_id , col_id = col_loc . type_id , col_loc . col_id result_c = f"result_{i}" func_lines += [ f"  data_{i} = df._data[{type_id}][{col_id}]" , f"  series_{i} = pandas.Series(data_{i}, name='{c}')" , f"  {result_c} = series_{i}.copy({series_params_str})" ] results . append ( ( c , result_c ) ) data = ', ' . join ( f'"{col}": {data}' for col , data in results ) func_lines += [ f"  return pandas.DataFrame({{{data}}}, {index})" ] func_text = '\n' . join ( func_lines ) global_vars = { 'pandas' : pandas } return func_text , global_vars