My first Personal Project: Dance Matching platform_ 8) 2020_04_20

dhsys112·2020년 4월 20일

To dos

1) Integrate all the csv

a. pd.concat ( add afterwards DF below the existing DF)

b. reset_index ( delete existing index of each row, and make new index, reflecting renewed index as a whole)

import pandas as pd

## 1. DEF
DF_etc = pd.read_csv("C:/Users/user/Desktop/Web_Study/Dance_Match/Def_Dance.csv", index_col = 0 ,sep = ",", encoding= "euc-kr", dtype ="unicode")

# print(DF_etc)

## 2. JJ 
JJ = pd.read_csv("C:/Users/user/Desktop/Web_Study/Dance_Match/JJ.csv", encoding = "euc-kr")

## 3. We_Flex
We_Flex = pd.read_csv("C:/Users/user/Desktop/Web_Study/Dance_Match/WeFlex.csv", encoding = "euc-kr")

## 4. Soul
Soul = pd.read_csv("C:/Users/user/Desktop/Web_Study/Dance_Match/Soul.csv", encoding = "utf-8")

Dance_Total_DF = pd.concat([DF_etc, JJ, We_Flex, Soul])

Dance_Total_DF = Dance_Total_DF.reset_index(drop = True)

Dance_Total_DF.to_csv("C:/Users/user/Desktop/Web_Study/Dance_Match/Dance_Total.csv", mode = "w", encoding = "utf-8-sig")

2) Move Excel to DB

코드를 입력from pymongo import MongoClient
import csv

# DB connectivity
client = MongoClient('localhost', 27017)
# dbsparta 라는 곳에 넣는다
dbsparta = client.dbsparta 
collection = dbsparta.collection 

# Function to parse csv to dictionary
def csv_to_dict():
    reader = csv.DictReader(open("C:/Users/user/Desktop/Web_Study/Dance_Match/Dance_Total.csv"))
    result = {}
    for row in reader:
# Academy_Name 자리에는 csv 의 첫 열 이름이 들어간다
        key = row.pop('Academy_Name')
        result[key] = row

    return result

# Final insert statement

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

1개의 댓글

2021년 9월 22일

In fact, many people should strongly consider producing a decent and quality personal statement; else, they will not be able to complete their application. That is why I am grateful that I was able to locate a unique organization, or more specifically, personal statement editing services. I was assisted here in statement of purpose for fellowship rapidly, and I was one of the first to file it. I obtained an excellent grade despite the fact that I had not expected to succeed. Best of luck!

답글 달기