text_extensions_for_pandas/io/watson/tables.py
def _explode_by_concat(df_in, column, agg_by: str = " "):
    """
    "shreds" the given field of the dataframe, by concatennating all elements of the given list of strings
    This is as compared with the "horizontal explode method, which separates out each element into its own column
    does not change the name of the column, simply replaces each list with the concatted form of itself.
    In some cases this may be a much more idiomatic way to deal with multilevel headers.
    :param df_in: the df to operate on
    :param column: the column in ``df_in`` to operate on
    :param agg_by: The character to place in between elements of the list. defaults to " " but can be set otherwise
    :return: the modified dataframe
    """

    def agg_horiz_headers(series):
        series[column] = agg_by.join(series[column])
        return series

    df = df_in.copy()
    df = df.apply(agg_horiz_headers, axis=1)
    return df, [column]

    "shreds" the given field of the dataframe, by concatennating all elements of the given list of strings
    This is as compared with the "horizontal explode method, which separates out each element into its own column
    does not change the name of the column, simply replaces each list with the concatted form of itself.
    In some cases this may be a much more idiomatic way to deal with multilevel headers.
    :param df_in: the df to operate on
    :param column: the column in ``df_in`` to operate on
    :param agg_by: The character to place in between elements of the list. defaults to " " but can be set otherwise
    :return: the modified dataframe
    
"shreds" the given field of the dataframe, by concatennating all elements of the given list of strings
This is as compared with the "horizontal explode method, which separates out each element into its own column
does not change the name of the column, simply replaces each list with the concatted form of itself.
In some cases this may be a much more idiomatic way to deal with multilevel headers.
" shreds " the given field of the dataframe by concatennating all elements of the given list of strings This is as compared with the " horizontal explode method which separates out each element into its own column does not change the name of the column simply replaces each list with the concatted form of itself . In some cases this may be a much more idiomatic way to deal with multilevel headers .
def _explode_by_concat(df_in, column, agg_by: str = " "):
    def agg_horiz_headers(series):
        series[column] = agg_by.join(series[column])
        return series
    df = df_in.copy()
    df = df.apply(agg_horiz_headers, axis=1)
    return df, [column]
def _explode_by_concat ( df_in , column , agg_by : str = " " ) : def agg_horiz_headers ( series ) : series [ column ] = agg_by . join ( series [ column ] ) return series df = df_in . copy ( ) df = df . apply ( agg_horiz_headers , axis = 1 ) return df , [ column ]
"shreds" the given field of the dataframe, by concatennating all elements of the given list of strings
This is as compared with the "horizontal explode method, which separates out each element into its own column
does not change the name of the column, simply replaces each list with the concatted form of itself.
" shreds " the given field of the dataframe by concatennating all elements of the given list of strings This is as compared with the " horizontal explode method which separates out each element into its own column does not change the name of the column simply replaces each list with the concatted form of itself .
"""
    "shreds" the given field of the dataframe, by concatennating all elements of the given list of strings
    This is as compared with the "horizontal explode method, which separates out each element into its own column
    does not change the name of the column, simply replaces each list with the concatted form of itself.
    In some cases this may be a much more idiomatic way to deal with multilevel headers.
    :param df_in: the df to operate on
    :param column: the column in ``df_in`` to operate on
    :param agg_by: The character to place in between elements of the list. defaults to " " but can be set otherwise
    :return: the modified dataframe
    """
the modified dataframe
the modified dataframe
df_in
the df to operate on
the df to operate on
column
the column in ``df_in`` to operate on
the column in ` ` df_in ` ` to operate on
agg_by
str
The character to place in between elements of the list. defaults to " " but can be set otherwise
The character to place in between elements of the list . defaults to " " but can be set otherwise
" " but can be set otherwise