Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

질문잇습니다 #49

Open
jojeongtaek opened this issue Apr 28, 2024 · 0 comments
Open

질문잇습니다 #49

jojeongtaek opened this issue Apr 28, 2024 · 0 comments

Comments

@jojeongtaek
Copy link

재무재표 크롤링에서 코드가 잘못된 부분이 있어 문의드립니다. 크롤링해오는 사이트의 날짜표시방식이 바뀐거같습니다.

2024-03 ▶ 2024/03 이런식으로 바뀌어서 제대로 크롤링을 해오지 못하는 문제가있네요 아래와같이 바꿔서 했더니 해결했습니다.

def clean_fs(df, ticker, frequency):

df = df[~df.loc[:, ~df.columns.isin(['계정'])].isna().all(axis=1)]
df = df.drop_duplicates(['계정'], keep='first')
df = pd.melt(df, id_vars='계정', var_name='기준일', value_name='값')
df = df[~pd.isnull(df['값'])]
df['계정'] = df['계정'].replace({'계산에 참여한 계정 펼치기': ''}, regex=True)
df['기준일'] = pd.to_datetime(df['기준일'],
                           format='%Y-%m') + pd.tseries.offsets.MonthEnd()
df['종목코드'] = ticker
df['공시구분'] = frequency

return df

변경 format='%Y/%m') + pd.tseries.offsets.MonthEnd()

@jojeongtaek jojeongtaek changed the title 질문잇습니 질문잇습니다 Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant