5시간코딩
[import] employees, departments 전체를 출력하세요. 본문
import 할 테이블은 oracle에서 employees와 departments 테이블을 export 하셔서 사용하시면 됩니다.
1. oracle
1)
select * from employees;
select * from departments;
2. r
1)
emp=read.csv("c:/data/employees.csv",header=T,stringsAsFactors = FALSE)
dept=read.csv("c:/data/departments.csv",header=T,stringsAsFactors = FALSE)
class(emp)
str(emp)
head(emp)
print(emp)
colnames(emp)
rownames(emp)
3. python
1)csv :: csv.reader
import csv
with open("c:/data/employees.csv","r") as f:
emp_csv=csv.reader(f)
res=[next(emp_csv)] #리스트 한 번 더 씌워주기
temp=[]
for i in emp_csv:
temp.append(i)
emp=title+temp
emp
dept도 위와 같은 방법으로 하면 됨
2)pandas :: read_csv
import pandas as pd
emp = pd.read_csv("c:/data/employees.csv")
dept = pd.read_csv("c:/data/departments.csv")
emp.index
emp.columns