Reputation: 477
3300 rows
I need make new single column with single tag each row
Upvotes: 0
Views: 533
Reputation: 642
You have to split and then explode your dataframe.
df['Tags'] = df['Tags'].astype('str')
for i in range(len(df)):
df.at[i, 'Tags'] = df[i, df['Tags'].strip('><').split('><')]
df.explode('Tags')
Upvotes: 0
Reputation: 862661
Use DataFrame.explode
(pandas 0.25+) with Series.str.strip
and Series.str.split
column Tags
for lists:
df1 = (df.assign(Tags = df['Tags'].str.strip('><').str.split('><'))
.explode('Tags')
.reset_index(drop=True))
Upvotes: 1