示例#1
0
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)
示例#2
0
def volatility():
    return respond_pandas(object=to_json(__series().ewm_volatility()),
                          format="json")
示例#3
0
def drawdown():
    return respond_pandas(object=to_json(__series().drawdown), format="json")
示例#4
0
def month():
    # return a frame...
    return respond_pandas(
        object=__series().monthlytable.applymap(__percentage), format="json")
示例#5
0
def performance():
    perf = __series().summary_format().apply(str)
    return respond_pandas(object=perf.to_dict(), format="json")
示例#6
0
def test_respond_json():
    x = ["A", "B"]
    assert json.loads(respond_pandas(x, "json").data) == x
示例#7
0
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)
示例#8
0
def json():
    return respond_pandas(object=frame, format="json")
示例#9
0
def csv():
    return respond_pandas(object=frame, format="csv")
示例#10
0
文件: api.py 项目: tschm/pyweb
def search(fmt):
    if fmt.lower().strip() == "html":
        return render_template("results.html")

    return respond_pandas(Whoosh.frame(), format=fmt)