df = pd.read_csv('땅두릅재배지.csv', encoding='utf-8')
# replace \n to comma
for i in range(len(df)):
df['ad2'][i] = df['ad'][i].replace('\n',',')
# split comma
test = []
for i in range(len(df)):
a = df2['ad2'].str.split(',')
for j in range(len(a)):
test.append(a[j])
inrow = []
for i in range(len(test)):
for j in range(len(test[i])):
inrow.append(test[i][j])
# list to dataframe
df2 = pd.DataFrame(inrow, columns=['ad'])
df2 = df2.drop_duplicates()
# save csv
df2.to_csv('땅두릅재배지_수정.csv', index=False)