https://github.com/beacon-biosignals/dataframeintervals.jl

Utilities for working with DataFrames of `Intervals.jl` or `TimeSpans.jl` objects.

https://github.com/beacon-biosignals/dataframeintervals.jl

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords from Contributors

numerical autograding archival interactive projection generic sequences packaging graphics julialang
Last synced: 10 months ago · JSON representation

Repository

Utilities for working with DataFrames of `Intervals.jl` or `TimeSpans.jl` objects.

Basic Info
  • Host: GitHub
  • Owner: beacon-biosignals
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Homepage:
  • Size: 224 KB
Statistics
  • Stars: 6
  • Watchers: 21
  • Forks: 1
  • Open Issues: 6
  • Releases: 2
Created about 4 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

DataFrameIntervals

CI Coverage Code Style: YASGuide Docs: Stable Docs: Dev

DataFrameIntervals provides two functions that are handy for computing joins over intervals of time: interval_join and groupby_interval_join, and a helper function called quantile_windows. See their doc strings for details.

Rows match in this join if their time spans overlap. The time spans can be represented as

There are several options to support additional types, such as AlignedSpans. One option is to add interface methods to support automatic conversions to intervals; see e.g. #13. Another option is to manually convert to a supported type; this can provide additional control over how the conversion takes place. For example, one can simply convert to TimeSpans: julia timespanify = :span => ByRow(TimeSpan) => :span interval_join(transform(df1, timespanify), transform(df2, timespanify); on=:span) For AlignedSpans, we can convert to integer indices, after checking the sample rates are all equal: julia using Compat # for allequal if !allequal(Iterators.flatten(((as.sample_rate for as in df1.span), (as.sample_rate for as in df2.span)))) throw(ArgumentError("Sampling rates do not all match!")) end integer_spanify = :span => ByRow(as -> Interval{Int, Closed, Closed}(as.first_index, as.last_index)) => :span interval_join(transform(df1, integer_spanify), transform(df2, integer_spanify); on=:span)

Example

```julia using TimeSpans using DataFrames using DataFrameIntervals using Distributions using Random using Dates

n = 100 tovalue(x) = Nanosecond(round(Int, x * 1e9)) times = cumsum(rand(MersenneTwister(hash((:dataframeintervals, 202206_01))), Gamma(3, 2), n+1)) spans = TimeSpan.(tovalue.(times[1:(end-1)]), tovalue.(times[2:end])) df = DataFrame(label = rand(('a':'d'), n), x = rand(n), span = spans) ```

100×3 DataFrame Row │ label x span │ Char Float64 TimeSpan ─────┼───────────────────────────────────────────────────── 1 │ b 0.0606309 TimeSpan(00:00:05.164631882, 00:… 2 │ a 0.961599 TimeSpan(00:00:08.853504418, 00:… 3 │ c 0.55525 TimeSpan(00:00:13.431519652, 00:… 4 │ d 0.058248 TimeSpan(00:00:25.929078264, 00:… ⋮ │ ⋮ ⋮ ⋮ 98 │ a 0.995222 TimeSpan(00:08:51.512608520, 00:… 99 │ d 0.188141 TimeSpan(00:08:56.662988067, 00:… 100 │ a 0.338053 TimeSpan(00:08:58.445446762, 00:…

```julia quarters = quantile_windows(4, df, label=:quarter)

interval_join(df, quarters, on=:span) ```

103×6 DataFrame Row │ quarter label x span_left span_right span │ Int64 Char Float64 TimeSpan TimeSpan TimeSpan ─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ 1 b 0.0606309 TimeSpan(00:00:05.164631882, 00:… TimeSpan(00:00:05.164631882, 00:… TimeSpan(00:00:05.164631882, 00:… 2 │ 1 a 0.961599 TimeSpan(00:00:08.853504418, 00:… TimeSpan(00:00:05.164631882, 00:… TimeSpan(00:00:08.853504418, 00:… 3 │ 1 c 0.55525 TimeSpan(00:00:13.431519652, 00:… TimeSpan(00:00:05.164631882, 00:… TimeSpan(00:00:13.431519652, 00:… 4 │ 1 d 0.058248 TimeSpan(00:00:25.929078264, 00:… TimeSpan(00:00:05.164631882, 00:… TimeSpan(00:00:25.929078264, 00:… ⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ 101 │ 4 a 0.995222 TimeSpan(00:08:51.512608520, 00:… TimeSpan(00:06:51.442142229, 00:… TimeSpan(00:08:51.512608520, 00:… 102 │ 4 d 0.188141 TimeSpan(00:08:56.662988067, 00:… TimeSpan(00:06:51.442142229, 00:… TimeSpan(00:08:56.662988067, 00:… 103 │ 4 a 0.338053 TimeSpan(00:08:58.445446762, 00:… TimeSpan(00:06:51.442142229, 00:… TimeSpan(00:08:58.445446762, 00:…

Related Packages

Below is a list of related packages and a brief indication of their differences from DataFrameIntervals.

  • TSx various operations on time series data: includes many features DataFrameIntervals does not aim to implement. Does not implement joins over intervals of time.
  • FlexiJoins generic join operations, including by interval predicates (∈, ⊆, ⊊, ⊋, ⊇, !isdisjoint): the algorithms applied here are more general purpose and are bound by the complexity of more general purpose data structures (e.g. KD-trees). DataFrameIntervals is (currently) bound by a lower complexity class for its specific use case.
  • InMemoryDatasets.jl includes inequality-like joins over intervals of time (where the interval is represented as two columns); this cannot yet achieve the behavior implemented in DataFrameIntervals, where multiple inequalities must be checked to determine overlap.

GitHub Events

Total
  • Delete event: 7
  • Issue comment event: 1
  • Push event: 16
  • Pull request review event: 7
  • Pull request event: 18
  • Create event: 8
Last Year
  • Delete event: 7
  • Issue comment event: 1
  • Push event: 16
  • Pull request review event: 7
  • Pull request event: 18
  • Create event: 8

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 30
  • Total Committers: 5
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.6
Past Year
  • Commits: 7
  • Committers: 1
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
David Little d****e@g****m 12
dependabot[bot] 4****] 11
Phillip Alday p****y 5
beacon-infra[bot] 9****] 1
Eric Hanson 5****n 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 12
  • Total pull requests: 36
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 23 days
  • Total issue authors: 5
  • Total pull request authors: 5
  • Average comments per issue: 2.17
  • Average comments per pull request: 0.94
  • Merged pull requests: 32
  • Bot issues: 0
  • Bot pull requests: 19
Past Year
  • Issues: 0
  • Pull requests: 14
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.14
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 14
Top Authors
Issue Authors
  • haberdashPI (7)
  • ericphanson (2)
  • palday (1)
  • beacon-buddy (1)
  • JuliaTagBot (1)
Pull Request Authors
  • dependabot[bot] (24)
  • haberdashPI (12)
  • palday (6)
  • github-actions[bot] (1)
  • ericphanson (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (24) github_actions (5)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
juliahub.com: DataFrameIntervals

Utilities for working with DataFrames of `Intervals.jl` or `TimeSpans.jl` objects.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 9.9%
Average: 24.9%
Dependent packages count: 39.8%
Last synced: 11 months ago