|
@@ -1,11 +1,13 @@
|
|
|
from tinydb import TinyDB, Query
|
|
|
import pandas as pd
|
|
|
+import numpy as np
|
|
|
+from scipy import stats
|
|
|
import matplotlib.pyplot as plt
|
|
|
from datetime import datetime,date
|
|
|
MarketDB = TinyDB('market.json')
|
|
|
PlayerDB = TinyDB('player.json')
|
|
|
|
|
|
-def getDF(card=None,aDate=None):
|
|
|
+def getDF(card=None,aDate=None,pruneOutliers=True):
|
|
|
"""
|
|
|
Supply either a card identifier or a date for filter by.
|
|
|
|
|
@@ -32,6 +34,8 @@ def getDF(card=None,aDate=None):
|
|
|
else:
|
|
|
d=MarketDB.search(Query()['date']==aDate)
|
|
|
df=pd.DataFrame(d)
|
|
|
+ if pruneOutliers:
|
|
|
+ df=df[np.abs(stats.zscore(df['cost'])) < 1.5]
|
|
|
df.sort_values(by=['card-num','date'], ascending=[True,True], inplace=True)
|
|
|
return df.round({'cost':2,'cost-min':0,'cost-max':0})
|
|
|
|