My first Personal Project: Dance Matching platform_4) 2020_04_15

dhsys112·2020년 4월 15일

"To do" 

> Just-Jerk Dance Academy Crawling

> frzmDance Crawling

> saving DF into CSV

import csv

data = [ [1,2,3,4],[5,6,7,8]]

csvfile = open("C:/Users/user/Desktop/Web_Study/Dance_Match/DanceMatch.csv", "w", newline="")

csvwriter = csv.writer(csvfile)

for row in data:

csvfile.close()를 입력하세요

> list slicing on lists brought by google-vision-api

> saving Koreans as it is into csv by using "Encoding"

Def_GangNam_MWF_A.to_csv("C:/Users/user/Desktop/Web_Study/Dance_Match/Dance.csv", encoding="utf-8-sig")

> solve error code when saving df to csv "PermissionError: [Errno 13] Permission denied: 'C:/Users/user/Desktop/Web_Study/Dance_Match/Dance.csv'"

maybe check the specific folder or file . and permit the access....!!!


you should close csv file while saving df into csv. close the csv file and run the python again

merging multiple DF into one DF + increasing index

Def_GangNam_Total_DF = pd.concat( [ Def_GangNam_MWF_A_DF, Def_GangNam_TUETHR_A_DF, Def_GangNam_SS_A_DF, Def_GangNam_MWF_B_DF, Def_GangNam_TUETHR_B_DF, Def_GangNam_SS_B_DF ], axis = 0)

Main point here is, you need [ ] , inside ( )
axix = 0 . is default, merging by rows( top, + bottom )

BUT, I also want to increase index of rows
just above code does not automatically increase index

Def_GangNam_Total_DF = Def_GangNam_Total_DF.reset_index(drop = True)

you have to go for two processes
1) delete exiting indexes
2) reset index

adding "drop = True" options is needed to delete existing index

Dream of being "물빵개" ( Go abroad for Dance and Programming)

0개의 댓글