These are chat archives for evhub/coconut

14th
Sep 2017
Paul-Yuchao-Dong
@Paul-Yuchao-Dong
Sep 14 2017 07:30
I think I just broke the pipe operator... But I don't really know what happened. It looks like you cannot pass to a keyword arg in the function?
import numpy as np

y=0.5
def loss(p,y):
    return -(y*np.log(p)+(1-y)*np.log(1-p))

p= np.arange(1e-3, 0.999, 1e-3)

l=loss(p,y)

(p |> len |> np.arange) |> pd.DataFrame$({'l':l}, index=? ) |> .iplot()

where as if I change the last line to:

{'l':l} |> pd.DataFrame$(index=(p |> len |> np.arange) ) |> .iplot()

this would work.

what is the coconista's way of doing the last line? Ideally I want to reduce the bulk in the index code