Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatmatto/timeframes
Dataframe-like API for timeseries-like data
https://github.com/fatmatto/timeframes
dataframe timeseries typescript
Last synced: 10 days ago
JSON representation
Dataframe-like API for timeseries-like data
- Host: GitHub
- URL: https://github.com/fatmatto/timeframes
- Owner: fatmatto
- License: mit
- Created: 2022-04-08T07:51:33.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-09T14:41:53.000Z (27 days ago)
- Last Synced: 2025-01-09T15:39:30.114Z (27 days ago)
- Topics: dataframe, timeseries, typescript
- Language: TypeScript
- Homepage: https://fatmatto.github.io/timeframes
- Size: 815 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Timeframes
Dataframe-like API for timeseries-like data
⚠️ This is still a work in progress## Quickstart
Install through NPM
```bash
npm i @apio/timeframes
```There are a few examples that you can check out in the [examples directory](https://github.com/fatmatto/timeframes/tree/main/examples).
## TimeSeries
![Timeseries](images/timeserie.png?raw=true "Timeseries")
```javascript
import { TimeSerie } from '@apio/timeframes'// Pass an array of points
// a point is a tuple [DateLike, PointValue]
// DateLike is value that can be passed to new Date()
// PointValue is any value, but preferably a number (to compute sums averages ecc)
const ts = new TimeSerie([["2022-01-01", 12],["2022-01-02", 13]])
const sum = ts.sum()
const avg = ts.avg()
```## TimeFrames
![Timeframes](images/timeframe.png?raw=true "Timeframes")
```javascript
import { TimeFrame } from '@apio/timeframes'
// Each item is a row
const rows = [
{time: "2022-01-01", value1:10, value2:140},
{time: "2022-01-02", value1:41}, // here value2 is null
{time: "2022-01-03", value1:78, value2:301},
]
const ts = new TimeFrame(rows)
// column() extracts columns as timeseries
const total1 = ts.column("value1").sum()
```