[Autoloop: build-tsb-pandas-typescript-migration] - #513
Draft
github-actions[bot] wants to merge 2 commits into
Draft
github-actions[bot] wants to merge 2 commits into
github-actions[bot] wants to merge 2 commits into
Conversation
…mestamp) Mirrors pandas.DatetimeIndex.to_period(), pandas.PeriodIndex.to_timestamp(), and pandas.Period.to_timestamp(). Adds: - to_period(idx, freq): DatetimeIndex -> PeriodIndex - PeriodIndex.to_timestamp(how): PeriodIndex -> DatetimeIndex - Period.to_timestamp(how): Period -> Date Differential tests compare against pandas 2.2.3 reference values (labels, dtype/freq, empty-index edge case) plus a round-trip property test. Adds a playground section demonstrating the conversions. Run: https://github.com/githubnext/tsb/actions/runs/35294423502 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
🤖 Iteration 508 accepted
Accepted and recorded in the state file (
|
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.
Iteration 508: Add Period/PeriodIndex ⇄ DatetimeIndex conversions
Pandas feature:
pandas.DatetimeIndex.to_period(),pandas.PeriodIndex.to_timestamp(),pandas.Period.to_timestamp()Adds bidirectional conversion between fixed-frequency
Period/PeriodIndexand calendar-basedDatetimeIndex:to_period(idx, freq)— maps each date in aDatetimeIndexto thePeriodthat contains it (pandas.DatetimeIndex.to_period(freq))PeriodIndex.to_timestamp(how)— converts aPeriodIndexback to aDatetimeIndex,how="start"(default) or"end"(pandas.PeriodIndex.to_timestamp())Period.to_timestamp(how)— single-period equivalent (pandas.Period.to_timestamp())Verification
tests/core/period.test.tscompare against pandas 2.2.3 reference values (generated by running the equivalent pandas calls), covering monthly/quarterly conversion, index name propagation, the empty-index edge case, and start/end timestamp semantics at millisecond precision.fast-check) verifiesto_period(to_timestamp(idx))recovers the original periods acrossM/Q/A/Dfrequencies.bun run typecheckpasses with no errors.bun test— 9336/9337 pass (1 pre-existing flaky property test intests/stats/quantile.test.ts, unrelated to this change and confirmed passing in isolation).playground/period.htmldemonstrating the conversions.Metric
pandas_features_ported(exported.tsfiles undersrc/, excludingindex.ts/.d.ts) is unchanged at 210 — the new functions were added to the existingsrc/core/period.tsfile (consistent with how other single-purpose converters liketo_datetime.ts/to_numeric.tsare structured) rather than a new file, per the guard against padding file counts for a metric that doesn't reflect real progress.Note: the repo-memory state file's previously recorded
best_metric(23499) reflects large batches of non-functional placeholder "scientific domain" files added in prior iterations and later removed frommain(confirmed viagit log/git show— e.g. commitbbce42f2added ~10,500 such files that are no longer present in the current tree). The verified, current baseline onmainis 210.🤖 Generated by Autoloop.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com