250x250
Link
๋‚˜์˜ GitHub Contribution ๊ทธ๋ž˜ํ”„
Loading data ...
Notice
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

Data Science LAB

[Python] Pandas iterrows()๋กœ ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์˜ ํ–‰ ๋ฐ˜๋ณต ๋ณธ๋ฌธ

๐Ÿ Python/Pandas

[Python] Pandas iterrows()๋กœ ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์˜ ํ–‰ ๋ฐ˜๋ณต

ใ…… ใ…œ ใ…” ใ…‡ 2022. 8. 12. 02:15
728x90

Pandas ์—์„œ๋Š” ๊ธฐ๋ณธ ํ•จ์ˆ˜๋กœ iterrows๋ฅผ ์ œ๊ณตํ•œ๋‹ค. 

iterrow๋ฅผ ํ™œ์šฉํ•˜๋ฉด ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์—ด์„ ํ•˜๋‚˜ํ•˜๋‚˜ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ๋‹ค. 

 

for _, row in cutoff_dates.iterrows():
    print(_)
    print(row)

 

for๋ฌธ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ ํ–‰์˜ (index, row_series)๋ฅผ ์ฐจ๋ก€๋Œ€๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค. 

728x90
Comments