= 80]) # Q1-3. print(data_frame[ data_frame[["math", "english", "science"]].mean(axis=1) >= 80]) # Q1. info_names = ["정기찬", "강나언", "권혜진", "이성민", "조승환"] info_MBTI = ["ESFJ", "ISFP", "ISFP", "INFJ", "INFP"] info_dpt = ["ENT","DS","DS","EEG&DS","DS"] info_roles = ["조장", None, None, None, "10대"] info_ages = [25, 20, 24, 23, 19] info_stu_ID = [22, 23, 22, 20, 23] # Q2. team6_info = pd.DataFrame({ "이름" : info_names, "MBTI" : info_MBTI, "학과" : info_dpt, "역할" : info_roles, "나이" : info_ages, "학번" : info_stu_ID }) print(team6_info) # Q3. team6_info.to"> = 80]) # Q1-3. print(data_frame[ data_frame[["math", "english", "science"]].mean(axis=1) >= 80]) # Q1. info_names = ["정기찬", "강나언", "권혜진", "이성민", "조승환"] info_MBTI = ["ESFJ", "ISFP", "ISFP", "INFJ", "INFP"] info_dpt = ["ENT","DS","DS","EEG&DS","DS"] info_roles = ["조장", None, None, None, "10대"] info_ages = [25, 20, 24, 23, 19] info_stu_ID = [22, 23, 22, 20, 23] # Q2. team6_info = pd.DataFrame({ "이름" : info_names, "MBTI" : info_MBTI, "학과" : info_dpt, "역할" : info_roles, "나이" : info_ages, "학번" : info_stu_ID }) print(team6_info) # Q3. team6_info.to"> = 80]) # Q1-3. print(data_frame[ data_frame[["math", "english", "science"]].mean(axis=1) >= 80]) # Q1. info_names = ["정기찬", "강나언", "권혜진", "이성민", "조승환"] info_MBTI = ["ESFJ", "ISFP", "ISFP", "INFJ", "INFP"] info_dpt = ["ENT","DS","DS","EEG&DS","DS"] info_roles = ["조장", None, None, None, "10대"] info_ages = [25, 20, 24, 23, 19] info_stu_ID = [22, 23, 22, 20, 23] # Q2. team6_info = pd.DataFrame({ "이름" : info_names, "MBTI" : info_MBTI, "학과" : info_dpt, "역할" : info_roles, "나이" : info_ages, "학번" : info_stu_ID }) print(team6_info) # Q3. team6_info.to">
# SAI Season7 S+ Team6 "SUPLeme"
# Written by Seunghwan Jo
# 4th week
# ====================================================================================== #
# Practical Problem
# Q1.
import pandas as pd
filename = "C:/Users/Seunghwan Jo/Downloads/excel_exam.xlsx"
data_frame = pd.read_excel(filename, engine="openpyxl")
# Q1-1.
print(data_frame[["id", "math"]])
# Q1-2.
print(data_frame[data_frame["math"] >= 80])
# Q1-3.
print(data_frame[ data_frame[["math", "english", "science"]].mean(axis=1) >= 80])
# Q1.
info_names = ["정기찬", "강나언", "권혜진", "이성민", "조승환"]
info_MBTI = ["ESFJ", "ISFP", "ISFP", "INFJ", "INFP"]
info_dpt = ["ENT","DS","DS","EEG&DS","DS"]
info_roles = ["조장", None, None, None, "10대"]
info_ages = [25, 20, 24, 23, 19]
info_stu_ID = [22, 23, 22, 20, 23]
# Q2.
team6_info = pd.DataFrame({
"이름" : info_names,
"MBTI" : info_MBTI,
"학과" : info_dpt,
"역할" : info_roles,
"나이" : info_ages,
"학번" : info_stu_ID
})
print(team6_info)
# Q3.
team6_info.to_csv("team6_info.csv", index=False, na_rep="-", encoding="euc-kr")
# ====================================================================================== #
# Theoretical Problem
# Q1. O
# Q2. O
# Q3. X(To delete a column, the code should be like this: data_frame.drop(index, axis = 1))
# Q4. O
# Q5. X(df[1:3] returns two rows: from 1th row to 2nd row)
# Q1. X(correct code would be like this: regex = 'k$')
# Q2. O
# Q3. X(correct code would be like this: from collections import OrderedDict)
# Q4. X(The method defaultly shows first five data)
# Q5. X(To delete a column, the code should be like this: data_frame.drop(index, axis = 1))
# Q6. O