
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
선생님의 데이터프레임과 제가 보고 있는 데이터 프레임이 조금 달라요.


작성한 코드 및 에러 메세지
import requests
from bs4 import BeautifulSoup
import pandas as pd
url = 'https://finance.naver.com/item/main.nhn?code=005930'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
financial_data = []
table = soup.find('table', {'class': 'tb_type1_ifrs'})
if table:
rows = table.find_all('tr')
for row in rows:
columns = row.find_all(['th', 'td'])
column_data = [col.get_text().strip() for col in columns]
# 각 행의 열 수가 11개이므로 모든 열을 가져옵니다.
financial_data.append(column_data)
# 데이터프레임 생성
df = pd.DataFrame(financial_data)
# 헤더를 첫 번째 행으로 설정하고, 데이터로부터 제거합니다.
header = df.iloc[0]
df = df[1:]
df.columns = header
# 결과 출력
print(df)
