Skip to content

rows x columns is not JSON serializable?  #157

@chinobing

Description

@chinobing

I am trying to share the data between callbacks with "Storing Data in Hidden Div" method.

  1. First of all, I get multiple stock prices and put it into a pd.DataFrame, then I save it as a json file.
  2. I follow the tutorials to pd.read_json file first, the save it to the immediate Div. here is the code:
#json data processing
def data_table():
    df = pd.read_json('matrix_table.json')
    return df
    
@app.callback(dash.dependencies.Output('intermediate-value', 'children'), 
              [dash.dependencies.Input('stock-ticker-input', 'value')])
def clean_data(value):
     # if "Dropdown" has value input
     if value:
         cleaned_df = data_table()
    
         return cleaned_df  

@app.callback(dash.dependencies.Output('table', 'children'), 
              [dash.dependencies.Input('intermediate-value', 'children')])
def update_table(jsonified_cleaned_data):

    return jsonified_cleaned_data

it turns out to be an error message.

20171110141058

20171110141117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions