Skip to content

Commit

Permalink
updated example in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Der-Henning committed Jan 1, 2023
1 parent 9ff6a5f commit d1d3652
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ python -m pip install git+https://github.com/Der-Henning/TopK-Insights
## Example

````Python
import pandas as pd
import logging

import matplotlib.pyplot as plt
import pandas as pd

from tki import TKI
from tki.insights import OutstandingFirstInsight, OutstandingLastInsight, \
TrendInsight, EvennessInsight, CorrelationInsight
from tki.extractors import RankExtractor, DeltaPrevExtractor, \
DeltaMeanExtractor, ProportionExtractor
from tki.aggregators import SumAggregator
from tki.dimensions import CardinalDimension, TemporalDimension, NominalDimension
from tki.dimensions import (CardinalDimension, NominalDimension,
TemporalDimension)
from tki.extractors import (DeltaMeanExtractor, DeltaPrevExtractor,
ProportionExtractor, RankExtractor)
from tki.insights import (CorrelationInsight, EvennessInsight,
OutstandingFirstInsight, OutstandingLastInsight,
TrendInsight)

logging.basicConfig()
logging.getLogger('tki').setLevel(logging.INFO)

data = [
['H', 2010, 40], ['T', 2010, 38], ['F', 2010, 13], ['B', 2010, 20],
Expand All @@ -38,7 +45,6 @@ data = [
['H', 2013, 43], ['T', 2013, 29], ['F', 2013, 23], ['B', 2013, 17],
['H', 2014, 58], ['T', 2014, 36], ['F', 2014, 27], ['B', 2014, 19]
]

extractors = {
RankExtractor,
DeltaPrevExtractor,
Expand Down Expand Up @@ -70,7 +76,7 @@ tki.run()

fig, axes = plt.subplots(7, 3, figsize=(25, 40), dpi=80)
for idx, i in enumerate(tki.heap.insights):
plt.axes(axes[int(idx/3)][idx % 3])
plt.axes(axes[int(idx / 3)][idx % 3])
i.plot()
plt.title(
f"{idx + 1}) {type(i.insight).__name__} "
Expand Down

0 comments on commit d1d3652

Please # to comment.