4da1369fe0d4e8eb693ea96064c229ed5248f004,janitor/functions.py,,deconcatenate_column,#Any#Any#Any#Any#Any#Any#,886

Before Change


        if len(df.columns) != (
            len(df_original.columns) + len(new_column_names) - 1
        ):
            raise JanitorError(
                "number of columns after deconcatenation is incorrect"
            )
    return df


@pf.register_dataframe_method

After Change


            )
        df_deconcat = df[column_name].str.split(sep, expand=True)
    else:
        df_deconcat = pd.DataFrame(
            df[column_name].to_list(), columns=new_column_names, index=df.index
        )

    if preserve_position:
        // Keep a copy of the original dataframe
        df_original = df.copy()

    if new_column_names is None and autoname is None:
        raise ValueError(
            "One of `new_column_names` or `autoname` must be supplied."
        )

    if autoname:
        new_column_names = [
            f"{autoname}{i}" for i in range(1, df_deconcat.shape[1] + 1)
        ]

    if not len(new_column_names) == df_deconcat.shape[1]:
        raise JanitorError(
            f"Number of supplied column names was not equal to the number of "
            f"deconcatenated columns. You need to provide "
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: ericmjl/pyjanitor
Commit Name: 4da1369fe0d4e8eb693ea96064c229ed5248f004
Time: 2019-10-09
Author: zbarry@protonmail.com
File Name: janitor/functions.py
Class Name:
Method Name: deconcatenate_column


Project Name: EducationalTestingService/skll
Commit Name: ca10c185d94470054d693f19e7691523dbe3ec55
Time: 2019-03-05
Author: jbiggs@ets.org
File Name: skll/data/readers.py
Class Name: NDJReader
Method Name: _sub_read


Project Name: kengz/SLM-Lab
Commit Name: 60d3325b8551cc6f7592e1266878818ad07d3b3a
Time: 2018-01-13
Author: kengzwl@gmail.com
File Name: slm_lab/experiment/analysis.py
Class Name:
Method Name: analyze_experiment