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://bokeh.pydata.org/en/latest/docs/user_guide/server.html#userguide-server-applications
What is this 'from helpers import load_data
' module?
python bokeh
add a comment |
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://bokeh.pydata.org/en/latest/docs/user_guide/server.html#userguide-server-applications
What is this 'from helpers import load_data
' module?
python bokeh
That is one place where you would put your own code - in the example, they move all the loading data code into another file, helpers.py and import the function. This would allow you to keep the main file more concise
– jeremycg
Jan 3 at 19:41
Perhaps it was not as clear as it could be in the docs. That code snippet is intended to be merely suggestive of typical usage, not demonstrative of any specific, actual use case or code. i.e., "typically a user would load their data here"
– bigreddot
Jan 3 at 20:00
add a comment |
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://bokeh.pydata.org/en/latest/docs/user_guide/server.html#userguide-server-applications
What is this 'from helpers import load_data
' module?
python bokeh
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://bokeh.pydata.org/en/latest/docs/user_guide/server.html#userguide-server-applications
What is this 'from helpers import load_data
' module?
python bokeh
python bokeh
edited Jan 3 at 20:09
keepAlive
3,22041224
3,22041224
asked Jan 3 at 19:34
Anna BernbaumAnna Bernbaum
134
134
That is one place where you would put your own code - in the example, they move all the loading data code into another file, helpers.py and import the function. This would allow you to keep the main file more concise
– jeremycg
Jan 3 at 19:41
Perhaps it was not as clear as it could be in the docs. That code snippet is intended to be merely suggestive of typical usage, not demonstrative of any specific, actual use case or code. i.e., "typically a user would load their data here"
– bigreddot
Jan 3 at 20:00
add a comment |
That is one place where you would put your own code - in the example, they move all the loading data code into another file, helpers.py and import the function. This would allow you to keep the main file more concise
– jeremycg
Jan 3 at 19:41
Perhaps it was not as clear as it could be in the docs. That code snippet is intended to be merely suggestive of typical usage, not demonstrative of any specific, actual use case or code. i.e., "typically a user would load their data here"
– bigreddot
Jan 3 at 20:00
That is one place where you would put your own code - in the example, they move all the loading data code into another file, helpers.py and import the function. This would allow you to keep the main file more concise
– jeremycg
Jan 3 at 19:41
That is one place where you would put your own code - in the example, they move all the loading data code into another file, helpers.py and import the function. This would allow you to keep the main file more concise
– jeremycg
Jan 3 at 19:41
Perhaps it was not as clear as it could be in the docs. That code snippet is intended to be merely suggestive of typical usage, not demonstrative of any specific, actual use case or code. i.e., "typically a user would load their data here"
– bigreddot
Jan 3 at 20:00
Perhaps it was not as clear as it could be in the docs. That code snippet is intended to be merely suggestive of typical usage, not demonstrative of any specific, actual use case or code. i.e., "typically a user would load their data here"
– bigreddot
Jan 3 at 20:00
add a comment |
1 Answer
1
active
oldest
votes
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.
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
@Anna Then you would have to load your two CSVs withinload_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.
– keepAlive
Jan 3 at 22:39
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54028698%2frunning-a-bokeh-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
@Anna Then you would have to load your two CSVs withinload_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.
– keepAlive
Jan 3 at 22:39
|
show 2 more comments
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.
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
@Anna Then you would have to load your two CSVs withinload_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.
– keepAlive
Jan 3 at 22:39
|
show 2 more comments
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.
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.
edited Jan 3 at 20:05
answered Jan 3 at 19:50
keepAlivekeepAlive
3,22041224
3,22041224
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
@Anna Then you would have to load your two CSVs withinload_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.
– keepAlive
Jan 3 at 22:39
|
show 2 more comments
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
@Anna Then you would have to load your two CSVs withinload_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.
– keepAlive
Jan 3 at 22:39
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Any question @AnnaBernbaum ?
– keepAlive
Jan 3 at 19:51
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
Thank you for clarifying, that makes much more sense! I have lots of CSVs in my data folder, do I need to call 'load_data' for every single one?
– Anna Bernbaum
Jan 3 at 21:39
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
@Anna can't you merge all your CSVs in a first preprocessing phase?
– keepAlive
Jan 3 at 22:10
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
I will still have 2 separate ones for different types of data
– Anna Bernbaum
Jan 3 at 22:14
@Anna Then you would have to load your two CSVs within
load_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.– keepAlive
Jan 3 at 22:39
@Anna Then you would have to load your two CSVs within
load_data
and return them as one dict object whose keys would be presented to users in a select-menu box. Probably better to precise this point with a new question.– keepAlive
Jan 3 at 22:39
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54028698%2frunning-a-bokeh-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
That is one place where you would put your own code - in the example, they move all the loading data code into another file, helpers.py and import the function. This would allow you to keep the main file more concise
– jeremycg
Jan 3 at 19:41
Perhaps it was not as clear as it could be in the docs. That code snippet is intended to be merely suggestive of typical usage, not demonstrative of any specific, actual use case or code. i.e., "typically a user would load their data here"
– bigreddot
Jan 3 at 20:00