fins/summary の Code 列を文字列に固定し float 化(7203.0)を防止#117
Open
jevwithwind wants to merge 1 commit into
Open
Conversation
issue J-Quants#108 で報告された事象への対応。Code が数値で返却され欠損値と 混在すると float 化して "7203.0" となるため、DataFrame 化の前に レコード単位で文字列へ変換する。数値コード・英数字コードのテストを追加。 Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHAT
fins/summary(FinSummaryApiV2)のCode列を、DataFrame 化の前にレコード単位で文字列へ変換するよう修正しましたWHY
issue #108 で報告されている事象への対応です。
Codeが数値で返却されると、欠損値との混在時に pandas の型推論で float 化し、7203.0のような値になります。また 2024 年以降の英数字銘柄コード(例: 186A)は文字列として扱う必要があります。issue では
astype("string")が提案されていますが、float 化した後の列に適用すると"7203.0"が文字列のまま残ることを確認したため、pd.DataFrame.from_recordsの前にレコード単位で変換する方式としました。影響範囲
get_fin_summary/get_fin_summary_cursor/get_fin_summary_rangeのCode列が常に文字列になります(報告事象の修正であり、意図した変更です)fins/detailsなど他のエンドポイントにも起こり得ますが、本 PR は Ensure fins/statements LocalCode stays string (avoid 7203.0 float conversion) #108 で報告されたfins/summaryのみを対象としています。必要であれば別 PR で対応しますget_fin_summary_rangeのキャッシュに保存された CSV には float 化した Code("7203.0")が残っている場合があります。キャッシュの再生成で解消されますコミット方針