Projects/COVID-19 analysis
xml ๋ฐ์ดํฐ๋ฅผ csv ํ์ผ๋ก ์์ง 2 - ๊ณต๊ณต์ฌ๋๋ฌธ์๋ฐ์ดํฐ
์ง๋ ํฌ์คํ
์์ ๋ง์ํด๋๋ ธ๋, ๋ถ๋ถ์ ์์ ํด๋ณด๋ คํฉ๋๋ค. msg column์์ [๋๋๋ฌธ๊ตฌ์ฒญ] ์ด ๋ถ๋ถ์ ๋ค๋ฅธ ์ด๋ก ๋นผ๋ด๋ ์์
์ ํด๋ณด๊ฒ ์ต๋๋ค. 1. ์์ค์ฝ๋ f = open('SOSmsg.csv','r') rdr = csv.reader(f) list_a = [] cnt = 0 for line in rdr: a = line[3].replace('[', '',1) a = a.split( ']' , 1 ) list_a.append([line[0],line[1],line[2],a[0],a[-1]]) ft = open('new.csv','w',newline='') wr = csv.writer(ft) wr.writerows(list_a) f.close() 2. ์์ค์ฝ๋ ์ค๋ช
f = open('SOSmsg.csv',..