text_extensions_for_pandas/io/watson/tables.py
def _horiz_explode(df_in, column, drop_original=True):
    """
    Horizontal explode is the default way of 'exploding' the dataframe. It taes a dataframe, and a column that needs
    to be exploded. All list type elements in that column will be seperated into new columns of name ``{
    original_column_name}_{n}``, where n is the position of the elment in the list.

     So the first element in a list in
    ``"row_header"`` column would end up in the ``"row_header_0"`` column, and the second would be in the
    ``"row_header_1`` column etc.

    :param df_in: the dataframe to explode
    :param column: the name of the column as a string to explode. The column should contain listlike elements
    :param drop_original: bool. if ``True``, the original column is removed, otherwise it is left as is.
    :return: the exploded dataframe, and the list of the names of the columns created, as a tuple
    """
    # expands list of columns
    df = df_in.copy()
    # expand df.tags into its own dataframe
    tags = df[column].apply(pd.Series)
    tags = tags.rename(columns=lambda x: column + '_' + str(x))
    df = pd.concat([df[:], tags[:]], axis=1)

    if drop_original:
        df.drop(columns=column, inplace=True)
    return df, tags.columns.to_list()

    Horizontal explode is the default way of 'exploding' the dataframe. It taes a dataframe, and a column that needs
    to be exploded. All list type elements in that column will be seperated into new columns of name ``{
    original_column_name}_{n}``, where n is the position of the elment in the list.

     So the first element in a list in
    ``"row_header"`` column would end up in the ``"row_header_0"`` column, and the second would be in the
    ``"row_header_1`` column etc.

    :param df_in: the dataframe to explode
    :param column: the name of the column as a string to explode. The column should contain listlike elements
    :param drop_original: bool. if ``True``, the original column is removed, otherwise it is left as is.
    :return: the exploded dataframe, and the list of the names of the columns created, as a tuple
    
Horizontal explode is the default way of 'exploding' the dataframe. It taes a dataframe, and a column that needs
to be exploded. All list type elements in that column will be seperated into new columns of name ``{
original_column_name}_{n}``, where n is the position of the elment in the list.


Horizontal explode is the default way of ' exploding ' the dataframe . It taes a dataframe and a column that needs to be exploded . All list type elements in that column will be seperated into new columns of name ` ` { original_column_name } _ { n } ` ` where n is the position of the elment in the list .
def _horiz_explode(df_in, column, drop_original=True):
    df = df_in.copy()
    tags = df[column].apply(pd.Series)
    tags = tags.rename(columns=lambda x: column + '_' + str(x))
    df = pd.concat([df[:], tags[:]], axis=1)
    if drop_original:
        df.drop(columns=column, inplace=True)
    return df, tags.columns.to_list()
def _horiz_explode ( df_in , column , drop_original = True ) : df = df_in . copy ( ) tags = df [ column ] . apply ( pd . Series ) tags = tags . rename ( columns = lambda x : column + '_' + str ( x ) ) df = pd . concat ( [ df [ : ] , tags [ : ] ] , axis = 1 ) if drop_original : df . drop ( columns = column , inplace = True ) return df , tags . columns . to_list ( )
Horizontal explode is the default way of 'exploding' the dataframe.
Horizontal explode is the default way of ' exploding ' the dataframe .
"""
    Horizontal explode is the default way of 'exploding' the dataframe. It taes a dataframe, and a column that needs
    to be exploded. All list type elements in that column will be seperated into new columns of name ``{
    original_column_name}_{n}``, where n is the position of the elment in the list.

     So the first element in a list in
    ``"row_header"`` column would end up in the ``"row_header_0"`` column, and the second would be in the
    ``"row_header_1`` column etc.

    :param df_in: the dataframe to explode
    :param column: the name of the column as a string to explode. The column should contain listlike elements
    :param drop_original: bool. if ``True``, the original column is removed, otherwise it is left as is.
    :return: the exploded dataframe, and the list of the names of the columns created, as a tuple
    """ # expands list of columns # expand df.tags into its own dataframe
the exploded dataframe, and the list of the names of the columns created, as a tuple
the exploded dataframe and the list of the names of the columns created as a tuple
df_in
the dataframe to explode
the dataframe to explode
column
the name of the column as a string to explode. The column should contain listlike elements
the name of the column as a string to explode . The column should contain listlike elements
drop_original
bool. if ``True``, the original column is removed, otherwise it is left as is.
bool . if ` ` True ` ` the original column is removed otherwise it is left as is .