커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
1주차 google colab에 df.shape 값 궁금증!
undefined주차
북마크
성*진
댓글
1
추천
0
조회수
9
조회수
9
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


google colab에


df.shape 를 사용했을때


선생님은 16.11


저는 왜 15.11로 나올까요?



스파르타 즉문즉답





import pandas as pd

import requests

from bs4 import BeautifulSoup


# Set the URL of the financial statement page

url = 'https://finance.naver.com/item/main.nhn?code=005930'


# Send a GET request to the URL and get the HTML response

response = requests.get(url)


# Parse the HTML response using BeautifulSoup

soup = BeautifulSoup(response.content, 'html.parser')


# Find the table that contains the financial statement data

table = soup.find_all('table', {'class''tb_type1 tb_num tb_type1_ifrs'})[0]


# Convert the table data to a DataFrame

df = pd.read_html(str(table))[0]


# Set the column names to the first row of the table

df.columns = df.iloc[0]


# Remove the first row, which contains the column names, from the DataFrame

df = df.iloc[1:]


# Print the DataFrame

print(df)



----


0 매출액 2368070.0 2796048.0 3022314.0 2707267.0 765655.0 \

1 영업이익 359939.00 516339.00 433766.00 112900.00 138667.00

2 당기순이익 264078.00 399074.00 556541.00 123163.00 108379.00

3 영업이익률 15.20 18.47 14.35 4.17 18.11

4 순이익률 11.15 14.27 18.41 4.55 14.16

5 ROE(지배주주) 9.98 13.92 17.07 3.47 13.92

6 부채비율 37.07 39.92 26.41 NaN 39.92

7 당좌비율 214.82 196.75 211.68 NaN 196.75

8 유보율 30692.79 33143.62 38144.29 NaN 33143.62

9 EPS(원) 3841.00 5777.00 8057.00 1766.00 1567.00

10 PER(배) 21.09 13.55 6.86 36.86 13.55

11 BPS(원) 39406.00 43611.00 50817.00 51065.00 43611.00

12 PBR(배) 2.06 1.80 1.09 1.27 1.80

13 주당배당금(원) 2994.00 1444.00 1444.00 1438.00 NaN

14 시가배당률(%) 3.70 1.84 2.61 NaN NaN

15 배당성향(%) 77.95 25.00 17.92 NaN NaN


0 777815.0 772036.0 767817.0 704646.0 642012.0

1 141214.00 140970.00 108520.00 43061.00 10001.00

2 113246.00 110988.00 93892.00 238414.00 15068.00

3 18.15 18.26 14.13 6.11 1.56

4 14.56 14.38 12.23 33.84 2.35

5 15.13 15.10 13.42 17.07 NaN

6 39.34 36.64 36.35 26.41 NaN

7 202.26 219.39 226.19 211.68 NaN

8 34110.56 35054.68 35798.23 38144.29 NaN

9 1638.00 1613.00 1346.00 3460.00 182.00

10 10.92 8.65 8.61 6.86 351.47

11 45106.00 46937.00 49387.00 50817.00 NaN

12 1.54 1.21 1.08 1.09 NaN

13 NaN NaN NaN NaN NaN

14 NaN NaN NaN NaN NaN

15 NaN NaN NaN NaN NaN



스파르타 즉문즉답






취소
 공유
취소
댓글 0
댓글 알림
나의얼굴