1- # traces
2-
31<!-- [](https://pypi.python.org/pypi/traces) -->
42<!-- [](https://pypi.python.org/pypi/traces) -->
53<!-- [](https://traces.readthedocs.io/en/master/?badge=master) -->
97[ ![ codecov] ( https://codecov.io/gh/stringertheory/traces/branch/main/graph/badge.svg )] ( https://codecov.io/gh/stringertheory/traces )
108[ ![ Commit activity] ( https://img.shields.io/github/commit-activity/y/stringertheory/traces )] ( https://img.shields.io/github/commit-activity/m/stringertheory/traces )
119
10+ # traces
11+
1212A Python library for unevenly-spaced time series analysis.
1313
1414## Why?
@@ -29,7 +29,7 @@ analysis](https://traces.readthedocs.io/).
2929
3030To install traces, run this command in your terminal:
3131
32- ``` bash
32+ ``` shell
3333$ pip install traces
3434```
3535
@@ -44,7 +44,7 @@ The main object in traces is a [TimeSeries](https://traces.readthedocs.io/en/mas
4444create just like a dictionary, adding the five measurements at 6:00am,
45457:45:56am, etc.
4646
47- ``` python
47+ ``` pycon
4848>>> time_series = traces.TimeSeries()
4949>>> time_series[datetime(2042 , 2 , 1 , 6 , 0 , 0 )] = 0 # 6:00:00am
5050>>> 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
5757dictionary, you can look up the value at any time even if it's not one
5858of the measurement times.
5959
60- ``` python
60+ ``` pycon
6161>>> time_series[datetime(2042 , 2 , 1 , 11 , 0 , 0 )] # 11:00am
62620
6363```
6464
6565The ` distribution ` function gives you the fraction of time that the
6666` TimeSeries ` is in each state.
6767
68- ``` python
68+ ``` pycon
6969>>> time_series.distribution(
7070>>> start= datetime(2042 , 2 , 1 , 6 , 0 , 0 ), # 6:00am
7171>>> 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
8686forty individual ` TimeSeries ` and efficiently merges them into one
8787` TimeSeries ` where the each value is a list of all lights.
8888
89- ``` python
89+ ``` pycon
9090>>> trace_list = [... list of forty traces.TimeSeries ... ]
9191>>> count = traces.TimeSeries.merge(trace_list, operation = sum )
9292```
@@ -99,7 +99,7 @@ We also applied a `sum` operation to the list of states to get the
9999How many lights are on in the building on average during business hours,
100100from 8am to 6pm?
101101
102- ``` python
102+ ``` pycon
103103>>> histogram = count.distribution(
104104>>> start= datetime(2042 , 2 , 1 , 8 , 0 , 0 ), # 8:00am
105105>>> 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.
119119For example, you can use a ` TimeSeries ` to keep track the contents of a
120120grocery basket by the number of minutes within a shopping trip.
121121
122- ``` python
122+ ``` pycon
123123>>> time_series = traces.TimeSeries()
124124>>> time_series[1.2 ] = {' broccoli' }
125125>>> time_series[1.7 ] = {' broccoli' , ' apple' }
126126>>> time_series[2.2 ] = {' apple' } # puts broccoli back
127127>>> time_series[3.5 ] = {' apple' , ' beets' } # mmm, beets
128128```
129129
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-
132130## More info
133131
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+
134134## Contributing
135135
136136Contributions are welcome and greatly appreciated! Please visit our [ guidelines] ( https://github.com/datascopeanalytics/traces/blob/master/CONTRIBUTING.md )
0 commit comments