-- 사용자 계정이 소유한 테이블에 대한 정보를 갖고 있는 테이블: user_tablesdesc user_tables;select * from user_tables;select table_name from user_tables;-- 사용자 계정이 소유한 테이블의 컬럼들에 대한 정보를 갖고 있는 테이블: user_tab_columnsdesc user_tab_columns;select * from user_tab_columns;-- emp 테이블이 가지고 있는 컬럼이름들을 검색select column_name from user_tab_columnswhere table_name = 'EMP'order by column_id; import cx_Oracleimport pandas as pd if __name__..
분류 전체보기
pandas 데이터 타입Series: 1차원 리스트. 인덱스가 무조건 한 개.DataFrame: 2차원 리스트. 인덱스가 행과 열 두 개를 갖음. import numpy as npimport pandas as pda = pd.Series([1, 3, 5, np.nan, 6, 8])print(type(a)) # Seriesprint(a) # Series에서 특정 인덱스의 아이템을 선택: Series(연산자).[index] 0 1.01 3.02 5.03 NaN4 6.05 8.0dtype: float64 # Series에서 특정 인덱스의 아이템 선택: Series[index]print(a[0]) # a[0]의 데이터 타입: float64# 인덱스 연산자([]) 안에서 범위 연산자(:)를 사용할 수도 있음pri..
# gapminder.tsv 파일을 읽어서 데이터 프레임 생성import pandas as pd df = pd.read_csv('gapminder.tsv', sep= '\t', encoding='UTF-8')print(df.iloc[0:5]) country continent year lifeExp pop gdpPercap0 Afghanistan Asia 1952 28.801 8425333 779.4453141 Afghanistan Asia 1957 30.332 9240934 820.8530302 Afghanistan Asia 1962 31.997 10267083 853.1007103 Afghanistan Asia 1967 34.020 11537966 836.1971384 Afghanistan Asia 1..
import osimport pandas as pdfile_path = os.path.join('..', 'scratch08', 'mpg.csv')df = pd.read_csv(file_path)print(df) manufacturer model displ year cyl ... drv cty hwy fl class0 audi a4 1.8 1999 4 ... f 18 29 p compact1 audi a4 1.8 1999 4 ... f 21 29 p compact2 audi a4 2.0 2008 4 ... f 20 31 p compact3 audi a4 2.0 2008 4 ... f 21 30 p compact4 audi a4 2.8 1999 6 ... f 16 26 p compact.. ... ... ..