https://steemitimages.com/DQmW99L4W9PjZm3cibpqZx2TGMM4w2y16PHgWg9f6x5PoHA/yoon.png <center> illustration by @carrotcake </center> *** ## 엑셀 파일 불러오기 엑셀 파일을 읽어와야 할 때가 있다. 웹에 있는 엑셀 파일일 수도 있고, 컴퓨터에 저장된 엑셀 파일일 수도 있다. 엑셀 파일을 파이썬으로 어떻게 읽어오는지 알아보자. ## 파이썬으로 가져오기 #### 웹에서 가져오기 웹에 있는 파일을 읽어오려면, 파일에 마우스 오른쪽 버튼을 눌러 `링크 주소 복사`한 다음 아래 링크 주소에 넣어준다. pd.read_excel은 첫번째 시트를 기본적으로 읽어오므로 시트가 여러개면 `sheet_name`를 넣어준다. ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline df=pd.read_excel('https://www.dallasfed.org/~/media/documents/institute/houseprice/hp1802.xlsx',sheet_name='HPI') print(df) ``` ###### 출력 결과  #### 컴퓨터에서 가져오기 컴퓨터에 있는 파일을 읽어오려면 주소를 다음과 같이 입력한다. 파일 경로는 파일에 마우스 오른쪽 버튼을 눌러 `속성`으로 들어간 다음, `위치`에서 가져오면 된다. 그때 주소가 `C:\Users\PC\Downloads` 이렇게 표시되어 있는데, `\`를 `/`로 바꿔주어야 한다. ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline df=pd.read_excel('C:/Users/PC/Downloads/hp1802.xlsx',sheet_name='HPI') print(df) ``` #### 인덱스 지정 시계열 분석을 위해 맨 왼쪽 열에 있는 시계열을 인덱스로 지정해줍니다. 엑셀에 Time을 넣어준 다음, set_index()를 이용합니다. `df.set_index('Time')` 윗줄을 추가해주면 아래와 같이 정렬됩니다. ###### 출력 결과 
author | yoon |
---|---|
permlink | python |
category | kr |
json_metadata | {"community":"busy","app":"busy/2.5.6","format":"markdown","tags":["kr","kr-dev","busy","jjangjjangman"],"users":["carrotcake"],"links":["/@carrotcake"],"image":["https://steemitimages.com/DQmW99L4W9PjZm3cibpqZx2TGMM4w2y16PHgWg9f6x5PoHA/yoon.png","https://ipfs.busy.org/ipfs/QmcDu4i8BJjituXiNsG36prpKyPT71gULjXxqLMqDLLqpb","https://ipfs.busy.org/ipfs/QmR9odHqCRJyWeksfq2Pq4ouoqYYVgZya7JY6oxDFhmm7w"]} |
created | 2018-11-14 12:40:18 |
last_update | 2018-11-14 12:40:18 |
depth | 0 |
children | 10 |
last_payout | 2018-11-21 12:40:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 4.071 HBD |
curator_payout_value | 1.224 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,397 |
author_reputation | 173,293,211,289,240 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,272,112 |
net_rshares | 7,368,543,723,630 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tombstone | 0 | 133,573,104,006 | 0.6% | ||
kevinwong | 0 | 108,372,286,487 | 1.5% | ||
mrwang | 0 | 180,212,154 | 0.75% | ||
arconite | 0 | 404,638,664 | 0.75% | ||
shortcut | 0 | 14,215,907,349 | 10% | ||
warofcraft | 0 | 40,344,584,443 | 20% | ||
eforucom | 0 | 3,371,441,730 | 1% | ||
busy.pay | 0 | 761,664,207,427 | 3.66% | ||
golbang | 0 | 234,724,251,118 | 30% | ||
heymattsokol | 0 | 943,210,852 | 15% | ||
ejemai | 0 | 14,420,136,314 | 10% | ||
paolobeneforti | 0 | 16,025,576,535 | 15% | ||
silviabeneforti | 0 | 5,211,986,232 | 10% | ||
alflo | 0 | 510,033,961 | 100% | ||
yoon | 0 | 206,859,061,584 | 100% | ||
hwan100 | 0 | 431,964,520,033 | 40% | ||
erb | 0 | 3,406,380,686 | 10% | ||
teachblogger | 0 | 498,124,133 | 5% | ||
kenan1989 | 0 | 2,860,405,471 | 50% | ||
toru | 0 | 556,739,354 | 100% | ||
leesol | 0 | 228,997,121,327 | 100% | ||
nukunit | 0 | 10,515,402,488 | 100% | ||
luvabi | 0 | 3,640,182,275 | 12.5% | ||
world-travel-pro | 0 | 1,007,468,425 | 0.5% | ||
bitrocker2020 | 0 | 17,641,152,530 | 10% | ||
jkkim | 0 | 25,884,516 | 10% | ||
jhy2246 | 0 | 15,056,931,426 | 13% | ||
tristan143 | 0 | 556,343,454 | 100% | ||
s292153s | 0 | 38,560,137,256 | 100% | ||
leesongyi | 0 | 237,616,514,605 | 100% | ||
kemal13 | 0 | 2,021,749,363 | 30% | ||
cheongpyeongyull | 0 | 198,801,773,859 | 14% | ||
bearone | 0 | 3,777,540,847 | 5% | ||
stylegold | 0 | 710,941,095 | 100% | ||
bree1042 | 0 | 30,623,818,139 | 30% | ||
reddragonfly | 0 | 3,605,569,521 | 20% | ||
skuld2000 | 0 | 131,916,790,573 | 25% | ||
beoped | 0 | 29,582,098,023 | 20% | ||
faluthi01 | 0 | 212,611,076 | 25% | ||
heather2222 | 0 | 45,346,159 | 100% | ||
khaiyoui | 0 | 140,024,591,348 | 5% | ||
affiedalfayed | 0 | 541,962,573 | 5% | ||
jinuking | 0 | 94,014,505,057 | 100% | ||
carrotcake | 0 | 1,670,409,691 | 5% | ||
coloringiship | 0 | 3,856,040,174 | 12.5% | ||
clarkgold | 0 | 35,088,134,541 | 100% | ||
syskwl | 0 | 14,573,247,382 | 30% | ||
bramd | 0 | 1,460,214,351,912 | 20% | ||
wildy | 0 | 253,474,093 | 50% | ||
wabangcute | 0 | 89,739,534,337 | 100% | ||
mintvilla | 0 | 14,792,851,920 | 30% | ||
leotrap | 0 | 2,021,797,085 | 2.5% | ||
minampusan | 0 | 127,760,377 | 100% | ||
steemitph | 0 | 14,769,465,316 | 25% | ||
yellowboy1010 | 0 | 37,733,031,857 | 100% | ||
bleyker | 0 | 163,847,323 | 50% | ||
mastertri | 0 | 92,865,477,456 | 20% | ||
nurhayati | 0 | 263,507,552 | 0.75% | ||
accelerator | 0 | 19,407,828,237 | 1.4% | ||
markjason | 0 | 1,373,782,287 | 50% | ||
anna-mi | 0 | 679,039,510 | 25% | ||
playitforward | 0 | 18,464,554,244 | 15% | ||
critic-on | 0 | 139,079,425 | 5% | ||
penauthor | 0 | 318,755,093 | 2.5% | ||
mrblinddraw | 0 | 6,184,181,401 | 45% | ||
animagic | 0 | 538,511,994 | 50% | ||
pewuf | 0 | 5,810,382,222 | 100% | ||
zulfan88 | 0 | 73,437,761 | 25% | ||
smaeunabs | 0 | 2,007,514,716 | 25% | ||
jaff8 | 0 | 6,627,747,687 | 10% | ||
scuzzy | 0 | 190,016,474 | 2.5% | ||
spectrums | 0 | 240,318,048 | 50% | ||
nairadaddy | 0 | 735,688,842 | 2.5% | ||
jeffbernst | 0 | 295,506,398 | 10% | ||
curazao | 0 | 45,391,066 | 50% | ||
sireh | 0 | 2,655,424,173 | 12.5% | ||
woolnami | 0 | 67,769,908,599 | 30% | ||
asyrafahamed | 0 | 575,784,425 | 15% | ||
paragon99 | 0 | 377,975,178 | 25% | ||
rasamuel | 0 | 2,543,174,777 | 25% | ||
jonnahmatias1016 | 0 | 116,768,114 | 25% | ||
eversloth | 0 | 53,483,834,781 | 25% | ||
fun2learn | 0 | 981,459,149 | 1.6% | ||
crypto3d | 0 | 4,753,682,700 | 25% | ||
gky | 0 | 101,140,606 | 25% | ||
silkroadgo | 0 | 141,811,028,986 | 30% | ||
muzige | 0 | 32,498,055 | 100% | ||
dennis76 | 0 | 1,805,372,223 | 100% | ||
sndbox-alpha | 0 | 23,322,301,592 | 50% | ||
kyunga | 0 | 55,829,378,173 | 50% | ||
noisysky | 0 | 8,295,692,271 | 20% | ||
kaeo | 0 | 189,063,604 | 50% | ||
rinbird | 0 | 191,105,262 | 50% | ||
joceo00 | 0 | 881,026,738,123 | 24% | ||
aimei | 0 | 88,471,819 | 25% | ||
eightbitfiction | 0 | 71,205,787 | 25% | ||
mbadayee | 0 | 352,512,400 | 25% | ||
opsteemit | 0 | 12,029,771,201 | 100% | ||
lifediaries2nd | 0 | 105,242,807 | 25% | ||
sanctuspierre | 0 | 89,200,560 | 25% | ||
ibez | 0 | 100,280,443 | 25% | ||
yungonkim | 0 | 171,528,201,176 | 100% | ||
sunstrip | 0 | 6,016,723 | 100% | ||
ezravandi | 0 | 426,829,974 | 2.29% | ||
carloniere | 0 | 89,751,166 | 50% | ||
juned0292 | 0 | 76,629,627 | 25% | ||
effofex | 0 | 74,089,170 | 0.7% | ||
angelinafx | 0 | 5,008,461,006 | 0.25% | ||
blockmountain | 0 | 147,192,619 | 25% | ||
tpvoter1 | 0 | 36,675,719 | 100% | ||
recordpool | 0 | 277,321,928 | 10% | ||
woolnyeo | 0 | 8,071,756,295 | 30% | ||
apteacher | 0 | 970,698,416 | 10% | ||
share4every1 | 0 | 90,346,188 | 100% | ||
crazyluv | 0 | 150,579,309 | 25% | ||
blockchainstudio | 0 | 10,657,145,502 | 100% | ||
kyle-event | 0 | 43,759,127 | 100% | ||
anpigon | 0 | 33,452,317,683 | 100% | ||
ferryfansuri | 0 | 105,025,052 | 25% | ||
zam398 | 0 | 146,423,960 | 25% | ||
merlion | 0 | 3,229,922,347 | 3% | ||
francescak | 0 | 0 | 1% | ||
kbaek81 | 0 | 114,583,367,875 | 100% | ||
carpet.duck | 0 | 145,988,688 | 25% | ||
pairplay | 0 | 180,035,209,268 | 100% | ||
nailyourhome | 0 | 1,034,345,533 | 1.6% | ||
pairplay1 | 0 | 1,620,103,695 | 100% | ||
pairplay-en | 0 | 0 | 100% | ||
pairplay-en1 | 0 | 6,350,762 | 100% | ||
jyinvest | 0 | 2,328,544,618 | 1% | ||
ujhg1004 | 0 | 957,717,649 | 30% | ||
bukio | 0 | 247,128,295,686 | 3.33% | ||
diyanti86 | 0 | 167,116,774 | 25% | ||
twotoedsloth | 0 | 13,991,320,176 | 25% | ||
delegate4upvot | 0 | 1,068,310,059 | 1.6% | ||
wakeprince | 0 | 4,724,637,057 | 100% | ||
up1 | 0 | 626,166,127 | 1.7% | ||
merlin7 | 0 | 4,827,666,007 | 0.25% | ||
pemburubitcoin | 0 | 71,752,202 | 25% | ||
steem-ua | 0 | 260,814,443,244 | 2.1% | ||
sashashelest | 0 | 538,735,494 | 100% | ||
jhonnfreiny | 0 | 72,451,294 | 25% | ||
nfc | 0 | 38,219,235,996 | 3% | ||
hdu | 0 | 431,320,413 | 1.5% | ||
arifkhan99 | 0 | 504,669,685 | 100% | ||
mirrorsteem | 0 | 489,905,644 | 100% |
파이썬 금욜에 다시 공부해보려구 합니다~^^
author | bbooaae |
---|---|
permlink | re-yoon-python-20181114t125541340z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-14 12:55:45 |
last_update | 2018-11-14 12:55:45 |
depth | 1 |
children | 1 |
last_payout | 2018-11-21 12:55:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 24 |
author_reputation | 67,197,492,770,252 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,272,798 |
net_rshares | 0 |
오오 그렇군요. 같이 하시죠 :)
author | yoon |
---|---|
permlink | re-bbooaae-re-yoon-python-20181115t122949106z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-15 12:29:51 |
last_update | 2018-11-15 12:29:51 |
depth | 2 |
children | 0 |
last_payout | 2018-11-22 12:29:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 18 |
author_reputation | 173,293,211,289,240 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,331,051 |
net_rshares | 0 |
 짱짱맨 호출에 응답하여 보팅하였습니다. 짱짱맨은 저자응원 프로그램입니다. 더 많은 저자 분들에게 더 큰 혜택을 드리고자 스파임대 스폰서를 받고 있습니다. 스폰서 참여방법과 짱짱맨 프로그램에 관해서는 [이 글](https://steemit.com/kr/@bukio/jjangjjang)을 읽어 주세요. 기업형 예비증인 북이오(@bukio)가 짱짱맨 프로그램을 운영하고 있습니다. 여러분의 증인 보팅은 큰 힘이 됩니다. [Vote for @bukio](https://steemconnect.com/sign/account_witness_vote?approve=1&witness=bukio)
author | bukio |
---|---|
permlink | re-bukio-jjangjjangman-1542236519940 |
category | kr |
json_metadata | "{"tags":["bukio", "jjangjjangman"],"app":"steemer/1.0"}" |
created | 2018-11-14 23:02:00 |
last_update | 2018-11-14 23:02:00 |
depth | 1 |
children | 0 |
last_payout | 2018-11-21 23:02:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 427 |
author_reputation | 11,545,563,591,097 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,301,176 |
net_rshares | 0 |
오호 깔끔하네요! 배우고 갑니다
author | jyinvest |
---|---|
permlink | re-yoon-python-20181114t142843533z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-14 14:28:45 |
last_update | 2018-11-14 14:28:45 |
depth | 1 |
children | 1 |
last_payout | 2018-11-21 14:28:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 17 |
author_reputation | 25,687,578,009,800 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,277,704 |
net_rshares | 0 |
감사합니다. ㅎㅎ
author | yoon |
---|---|
permlink | re-jyinvest-re-yoon-python-20181115t123000888z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-15 12:30:03 |
last_update | 2018-11-15 12:30:03 |
depth | 2 |
children | 0 |
last_payout | 2018-11-22 12:30:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 9 |
author_reputation | 173,293,211,289,240 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,331,057 |
net_rshares | 0 |
생각보다 쉽네요~ 저도 파이썬 한번 공부해 봐야겠어요
author | noisysky |
---|---|
permlink | re-yoon-python-20181114t132507855z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-14 13:25:09 |
last_update | 2018-11-14 13:25:09 |
depth | 1 |
children | 1 |
last_payout | 2018-11-21 13:25:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 30 |
author_reputation | 121,614,427,100,064 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,274,307 |
net_rshares | 0 |
ㅎㅎ 그래서 많이 배우는 거 같습니다. ^^
author | yoon |
---|---|
permlink | re-noisysky-re-yoon-python-20181115t122939583z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-15 12:29:42 |
last_update | 2018-11-15 12:29:42 |
depth | 2 |
children | 0 |
last_payout | 2018-11-22 12:29:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 24 |
author_reputation | 173,293,211,289,240 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,331,043 |
net_rshares | 0 |
#### Hi @yoon! Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation! Your **UA** account score is currently 4.643 which ranks you at **#1602** across all Steem accounts. Your rank has dropped 6 places in the last three days (old rank 1596). In our last Algorithmic Curation Round, consisting of 257 contributions, your post is ranked at **#120**. ##### Evaluation of your UA score: * Some people are already following you, keep going! * The readers like your work! * You have already shown user engagement, try to improve it further. **Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
author | steem-ua |
---|---|
permlink | re-python-20181114t231032z |
category | kr |
json_metadata | "{"app": "beem/0.20.9"}" |
created | 2018-11-14 23:10:33 |
last_update | 2018-11-14 23:10:33 |
depth | 1 |
children | 0 |
last_payout | 2018-11-21 23:10:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 668 |
author_reputation | 23,214,230,978,060 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,301,567 |
net_rshares | 0 |
파이썬... 공부해 볼만할것 같네요.
author | syskwl |
---|---|
permlink | re-yoon-python-20181115t051110105z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-15 05:11:09 |
last_update | 2018-11-15 05:11:09 |
depth | 1 |
children | 1 |
last_payout | 2018-11-22 05:11:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 20 |
author_reputation | 47,893,805,890,212 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,314,801 |
net_rshares | 0 |
같이 공부하시죠 ㅎㅎ
author | yoon |
---|---|
permlink | re-syskwl-re-yoon-python-20181115t122840205z |
category | kr |
json_metadata | {"tags":["kr"],"app":"steemit/0.1"} |
created | 2018-11-15 12:28:42 |
last_update | 2018-11-15 12:28:42 |
depth | 2 |
children | 0 |
last_payout | 2018-11-22 12:28:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 11 |
author_reputation | 173,293,211,289,240 |
root_title | "[Python!] 엑셀 파일을 읽어보자." |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 75,331,004 |
net_rshares | 0 |