Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preprocess decorator: null_handler does not work #3

Open
coristig opened this issue Jan 25, 2016 · 0 comments
Open

preprocess decorator: null_handler does not work #3

coristig opened this issue Jan 25, 2016 · 0 comments
Labels

Comments

@coristig
Copy link
Contributor

from yhat import Yhat, YhatModel , preprocess
import pandas as pd

class ReturnSentData(YhatModel):
    @preprocess(in_type=pd.DataFrame, out_type=dict, null_handler=[{"name":"key_2","na_filler":"No_value"}])
    def execute(self, data):
        return { "data_sent": data }

ReturnSentData().execute({"key_1": "value_1","key_2": ""})
Out[83]:
{'data_sent':      key_1 key_2
 0  value_1      }

It works below, but this is invalid json

ReturnSentData().execute({"key_1": "value_1","key_2": None})
Out[83]:
{'data_sent':      key_1     key_2
 0  value_1  No_value}
@coristig coristig added the bug label Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant