def test_respond_frame_csv(nav): x = nav.to_frame(name="Maffay") response = respond_pandas(x, "csv") f = pd.read_csv(StringIO(response.data.decode("utf-8")), index_col=0, header=0, parse_dates=True) pt.assert_frame_equal(f, x, check_names=False)
def volatility(): return respond_pandas(object=to_json(__series().ewm_volatility()), format="json")
def drawdown(): return respond_pandas(object=to_json(__series().drawdown), format="json")
def month(): # return a frame... return respond_pandas( object=__series().monthlytable.applymap(__percentage), format="json")
def performance(): perf = __series().summary_format().apply(str) return respond_pandas(object=perf.to_dict(), format="json")
def test_respond_json(): x = ["A", "B"] assert json.loads(respond_pandas(x, "json").data) == x
def test_respond_frame_json(nav): x = nav.to_frame(name="Maffay") response = respond_pandas(x, "json") pt.assert_frame_equal( pd.read_json(response.data, typ="frame", orient="table"), x)
def json(): return respond_pandas(object=frame, format="json")
def csv(): return respond_pandas(object=frame, format="csv")
def search(fmt): if fmt.lower().strip() == "html": return render_template("results.html") return respond_pandas(Whoosh.frame(), format=fmt)