Skip to content

Add constructor from TS to TS. Add Base.copy and Base.similar with the DataFrame semantics.#34

Open
Emmanuel-R8 wants to merge 6 commits into
xKDR:mainfrom
Emmanuel-R8:Add_Constructor
Open

Add constructor from TS to TS. Add Base.copy and Base.similar with the DataFrame semantics.#34
Emmanuel-R8 wants to merge 6 commits into
xKDR:mainfrom
Emmanuel-R8:Add_Constructor

Conversation

@Emmanuel-R8
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/TS.jl Outdated
struct TS

coredata :: DataFrame
coredata::DataFrame
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please commit formatting changes such as space removals in a separate PR. It gets difficult to review the diffs.

Comment thread src/utils.jl Outdated

```
"""
Base.similar(ts::TS, rows::Integer=nrow(ts)) = TS(similar(ts.coredata, rows))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change similar(ts.coredata, ...) to use DataFrames.similar()? This is to avoid conflicts if both packages are loaded into REPL.

Copy link
Copy Markdown
Contributor Author

@Emmanuel-R8 Emmanuel-R8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting changes reverted. similar -> DataFrames::similar

@smishr
Copy link
Copy Markdown

smishr commented Mar 3, 2023

@chiraganand @codetalker7 are Base.copy and Base.similar required? Either close PR or review and suggest changes to be merged.

takaymmt added a commit to takaymmt/TSFrames.jl that referenced this pull request Apr 4, 2026
Bug fixes:
- _fill_period_gaps: validate fill_gaps symbols against _VALID_FILL_SYMBOLS,
  throw ArgumentError for unknown strategies (e.g. :bogus)
- _apply_interpolate_gaps!: widen guard from AbstractFloat to Number,
  use round(ElemT, ...) for Int columns — fixes silent skip of integer cols
- _apply_interpolate_gaps!: add denom==0 guard for duplicate timestamps,
  fall back to left anchor instead of producing Inf/NaN
- resample(): validate fill_limit >= 1 in all three overloads,
  throw ArgumentError for fill_limit=0 or negative values

Code quality:
- Rename local T → ElemT in _apply_interpolate_gaps! (shadows convention)
- Use combined[!, :Index] column vector for is_gap mask (avoid row-wise access)

Tests (248 pass, +20 new):
- Testset xKDR#30: @test_throws ArgumentError for invalid fill_gaps symbols
- Testset #27b: :interpolate and constant fill preserve pre-existing missing
- Testset xKDR#31: fill_limit=0 and fill_limit=-1 throw ArgumentError
- Testset xKDR#32: :ffill fills mid-series gap (Feb between Jan+Mar)
- Testset xKDR#33: fill_limit ignored for :zero/:interpolate strategies
- Testset xKDR#34: :interpolate with Int column uses round() (Feb=152)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

3 participants