Anna Bernbaum
Anna Bernbaum

Reputation: 43

Running a Bokeh Server

I am trying to run my Flask app on a Bokeh server using the following command as recommended by the instructions:

bokeh serve --show myapp

I have also added this code to my script, as recommended:

from os.path import dirname, join
from helpers import load_data

load_data(join(dirname(__file__), 'data', 'things.csv'))

Instructions: https://docs.bokeh.org/en/latest/docs/user_guide/server.html#userguide-server-applications

What is this 'from helpers import load_data' module?

Upvotes: 1

Views: 560

Answers (1)

keepAlive
keepAlive

Reputation: 6655

The module helpers is not of prime interest, load_data is.

It is a function that you will have to create on purpose to load data from, say, a csv file, and which returns a pandas DataFrame. For example it could be something like

import pandas as pd    

def load_data(filepath):
    return pd.read_csv(filepath, index_col=0)

And then

load_data(
    filepath=join(dirname(__file__), 'data', 'things.csv')
)

One way of making this example yours, would be to define your own script helpers.py within your working directory, and then within this script, to define the function load_data as shown above.

Upvotes: 1

Related Questions