python - Splitting to make Workbooks -
if have column called name
, in column have names umbrella corp, umbrella inc, umbrella llc dont want loop through column , make workbook unique because 3 seperate workbooks.
so way split them @ first space , make workbooks unique?
so df['name'].str.split(' ', 1)
saying split @ first occurrence.
i want make workbooks split occurrence umbrella corp making workbook first split umbrella. instead of making multiple workbooks have 1 brings 3 of names have umbrella first split.
you create new column has first part of name , loop thru column:
df['newcolumn'] = df.brand_name.apply(lambda x: x.split(' ')[0])
Comments
Post a Comment