세무사 서찬영 세무회계 사무소

pandas 표 불러 오기(헤더 없이, 컬럼 이름 지정)

Untitled

표 읽어 오기

In [2]:
import pandas as pd
In [5]:
orders =pd.read_table('http://bit.ly/chiporders')
In [7]:
orders.head()
Out[7]:
order_id quantity item_name choice_description item_price
0 1 1 Chips and Fresh Tomato Salsa NaN $2.39
1 1 1 Izze [Clementine] $3.39
2 1 1 Nantucket Nectar [Apple] $3.39
3 1 1 Chips and Tomatillo-Green Chili Salsa NaN $2.39
4 2 2 Chicken Bowl [Tomatillo-Red Chili Salsa (Hot), [Black Beans... $16.98
In [15]:
user_cols = ['user_id', 'age','gender','occupation', 'zip_code']
movieusers = pd.read_table('http://bit.ly/movieusers', sep='|', header=None, names= user_cols)
In [16]:
movieusers.head()
Out[16]:
user_id age gender occupation zip_code
0 1 24 M technician 85711
1 2 53 F other 94043
2 3 23 M writer 32067
3 4 24 M technician 43537
4 5 33 F other 15213

댓글

Designed by JB FACTORY