From d1d3652ad4e6dcc16ea6446763145b9ac25741da Mon Sep 17 00:00:00 2001 From: Henning Merklinger Date: Sun, 1 Jan 2023 19:50:04 +0000 Subject: [PATCH] updated example in readme --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3482565..6bc6a95 100644 --- a/README.md +++ b/README.md @@ -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], @@ -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, @@ -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__} "