1
- # traces
2
-
3
1
<!-- [](https://pypi.python.org/pypi/traces) -->
4
2
<!-- [](https://pypi.python.org/pypi/traces) -->
5
3
<!-- [](https://traces.readthedocs.io/en/master/?badge=master) -->
9
7
[ ![ codecov] ( https://codecov.io/gh/stringertheory/traces/branch/main/graph/badge.svg )] ( https://codecov.io/gh/stringertheory/traces )
10
8
[ ![ Commit activity] ( https://img.shields.io/github/commit-activity/y/stringertheory/traces )] ( https://img.shields.io/github/commit-activity/m/stringertheory/traces )
11
9
10
+ # traces
11
+
12
12
A Python library for unevenly-spaced time series analysis.
13
13
14
14
## Why?
@@ -29,7 +29,7 @@ analysis](https://traces.readthedocs.io/).
29
29
30
30
To install traces, run this command in your terminal:
31
31
32
- ``` bash
32
+ ``` shell
33
33
$ pip install traces
34
34
```
35
35
@@ -44,7 +44,7 @@ The main object in traces is a [TimeSeries](https://traces.readthedocs.io/en/mas
44
44
create just like a dictionary, adding the five measurements at 6:00am,
45
45
7:45:56am, etc.
46
46
47
- ``` python
47
+ ``` pycon
48
48
>>> time_series = traces.TimeSeries()
49
49
>>> time_series[datetime(2042 , 2 , 1 , 6 , 0 , 0 )] = 0 # 6:00:00am
50
50
>>> time_series[datetime(2042 , 2 , 1 , 7 , 45 , 56 )] = 1 # 7:45:56am
@@ -57,15 +57,15 @@ What if you want to know if the light was on at 11am? Unlike a python
57
57
dictionary, you can look up the value at any time even if it's not one
58
58
of the measurement times.
59
59
60
- ``` python
60
+ ``` pycon
61
61
>>> time_series[datetime(2042 , 2 , 1 , 11 , 0 , 0 )] # 11:00am
62
62
0
63
63
```
64
64
65
65
The ` distribution ` function gives you the fraction of time that the
66
66
` TimeSeries ` is in each state.
67
67
68
- ``` python
68
+ ``` pycon
69
69
>>> time_series.distribution(
70
70
>>> start= datetime(2042 , 2 , 1 , 6 , 0 , 0 ), # 6:00am
71
71
>>> end= datetime(2042 , 2 , 1 , 13 , 0 , 0 ) # 1:00pm
@@ -86,7 +86,7 @@ How many lights are on throughout the day? The merge function takes the
86
86
forty individual ` TimeSeries ` and efficiently merges them into one
87
87
` TimeSeries ` where the each value is a list of all lights.
88
88
89
- ``` python
89
+ ``` pycon
90
90
>>> trace_list = [... list of forty traces.TimeSeries ... ]
91
91
>>> count = traces.TimeSeries.merge(trace_list, operation = sum )
92
92
```
@@ -99,7 +99,7 @@ We also applied a `sum` operation to the list of states to get the
99
99
How many lights are on in the building on average during business hours,
100
100
from 8am to 6pm?
101
101
102
- ``` python
102
+ ``` pycon
103
103
>>> histogram = count.distribution(
104
104
>>> start= datetime(2042 , 2 , 1 , 8 , 0 , 0 ), # 8:00am
105
105
>>> end= datetime(2042 , 2 , 1 , 12 + 6 , 0 , 0 ) # 6:00pm
@@ -119,18 +119,18 @@ long as they can be ordered. The values can be anything.
119
119
For example, you can use a ` TimeSeries ` to keep track the contents of a
120
120
grocery basket by the number of minutes within a shopping trip.
121
121
122
- ``` python
122
+ ``` pycon
123
123
>>> time_series = traces.TimeSeries()
124
124
>>> time_series[1.2 ] = {' broccoli' }
125
125
>>> time_series[1.7 ] = {' broccoli' , ' apple' }
126
126
>>> time_series[2.2 ] = {' apple' } # puts broccoli back
127
127
>>> time_series[3.5 ] = {' apple' , ' beets' } # mmm, beets
128
128
```
129
129
130
- To learn more, check the [ examples] ( https://traces.readthedocs.io/en/master/examples.html ) and the detailed [ reference] ( https://traces.readthedocs.io/en/master/api_reference.html# ) .
131
-
132
130
## More info
133
131
132
+ To learn more, check the [ examples] ( https://traces.readthedocs.io/en/master/examples.html ) and the detailed [ reference] ( https://traces.readthedocs.io/en/master/api_reference.html# ) .
133
+
134
134
## Contributing
135
135
136
136
Contributions are welcome and greatly appreciated! Please visit our [ guidelines] ( https://github.com/datascopeanalytics/traces/blob/master/CONTRIBUTING.md )
0 commit comments