bokeh.models.sources
¶AjaxDataSource
(**kwargs)¶Bases: bokeh.models.sources.RemoteSource
if_modified
¶property type: Bool
Whether to include an If-Modified-Since
header in AJAX requests
to the server. If this header is supported by the server, then only
new data since the last request will be returned.
[
{
"attributes": {
"callback": null,
"column_names": [],
"data": {},
"data_url": null,
"doc": null,
"id": "13219cfb-ea95-4f58-b4e7-3bf6ba4c908e",
"if_modified": false,
"max_size": null,
"method": "POST",
"mode": "replace",
"name": null,
"polling_interval": null,
"selected": {
"0d": {
"flag": false,
"indices": []
},
"1d": {
"indices": []
},
"2d": {
"indices": []
}
},
"tags": []
},
"id": "13219cfb-ea95-4f58-b4e7-3bf6ba4c908e",
"type": "AjaxDataSource"
}
]
BlazeDataSource
(**kwargs)¶Bases: bokeh.models.sources.RemoteSource
from_blaze
(remote_blaze_obj, local=True)¶to_blaze
()¶[
{
"attributes": {
"callback": null,
"column_names": [],
"data": {},
"data_url": null,
"doc": null,
"expr": {},
"id": "0022199b-1e21-427f-971f-4196e5b15201",
"local": null,
"name": null,
"namespace": {},
"polling_interval": null,
"selected": {
"0d": {
"flag": false,
"indices": []
},
"1d": {
"indices": []
},
"2d": {
"indices": []
}
},
"tags": []
},
"id": "0022199b-1e21-427f-971f-4196e5b15201",
"type": "BlazeDataSource"
}
]
ColumnDataSource
(*args, **kw)¶Bases: bokeh.models.sources.DataSource
Maps names of columns to sequences or arrays.
If the ColumnDataSource initializer is called with a single argument that is a dict or pandas.DataFrame, that argument is used as the value for the “data” attribute. For example:
ColumnDataSource(mydict) # same as ColumnDataSource(data=mydict)
ColumnDataSource(df) # same as ColumnDataSource(data=df)
Note
There is an implicit assumption that all the columns in a a given ColumnDataSource have the same length.
add
(data, name=None)¶Appends a new column of data to the data source.
Parameters: |
|
---|---|
Returns: | the column name used |
Return type: | str |
from_df
(*args, **kwargs)¶Create a dict
of columns from a Pandas DataFrame,
suitable for creating a ColumnDataSource.
Parameters: | data (DataFrame) – data to convert |
---|---|
Returns: | dict(str, list) |
Deprecated in Bokeh 0.9.3; please use ColumnDataSource initializer instead.
push_notebook
()¶Update date for a plot in the IPthon notebook in place.
This function can be be used to update data in plot data sources in the IPython notebook, without having to use the Bokeh server.
Returns: | None |
---|
Warning
The current implementation leaks memory in the IPython notebook, due to accumulating JS code. This function typically works well with light UI interactions, but should not be used for continuously updating data. See issue 1732 for more details and to track progress on potential fixes.
remove
(name)¶Remove a column of data.
Parameters: | name (str) – name of the column to remove |
---|---|
Returns: | None |
Note
If the column name does not exist, a warning is issued.
to_df
()¶Convert this data source to pandas dataframe.
If column_names
is set, use those. Otherwise let Pandas
infer the column names. The column_names
property can be
used both to order and filter the columns.
Returns: | DataFrame |
---|
vm_serialize
(changed_only=True)¶[
{
"attributes": {
"callback": null,
"column_names": [],
"data": {},
"doc": null,
"id": "9d3e38d5-d97e-4d86-bbf8-a08d28aa0d9e",
"name": null,
"selected": {
"0d": {
"flag": false,
"indices": []
},
"1d": {
"indices": []
},
"2d": {
"indices": []
}
},
"tags": []
},
"id": "9d3e38d5-d97e-4d86-bbf8-a08d28aa0d9e",
"type": "ColumnDataSource"
}
]
ColumnsRef
(**properties)¶A utility object to allow referring to a collection of columns from a specified data source, all together.
DataSource
(**kwargs)¶Bases: bokeh.plot_object.PlotObject
A base class for data source types. DataSource
is
not generally useful to instantiate on its own.
columns
(*columns)¶Returns a ColumnsRef object for a column or set of columns on this data source.
Parameters: | *columns – |
---|---|
Returns: | ColumnsRef |
callback
¶property type: Instance
(Callback)
A callback to run in the browser whenever the selection is changed.
selected
¶property type: Dict
(String
, Dict
(String
, Any
))
A dict to indicate selected indices on different dimensions on this DataSource. Keys are:
dict with the following keys:
patches) was hit:
2d: indicates whether a [multi]line or patches) were hit:
- indices (list(list)): indices of the lines/patches that were
hit/selected
[
{
"attributes": {
"callback": null,
"column_names": [],
"doc": null,
"id": "1c8a9757-6e65-4fda-a177-a7fb6c106337",
"name": null,
"selected": {
"0d": {
"flag": false,
"indices": []
},
"1d": {
"indices": []
},
"2d": {
"indices": []
}
},
"tags": []
},
"id": "1c8a9757-6e65-4fda-a177-a7fb6c106337",
"type": "DataSource"
}
]
RemoteSource
(**kwargs)¶[
{
"attributes": {
"callback": null,
"column_names": [],
"data": {},
"data_url": null,
"doc": null,
"id": "98883a7e-f288-4987-96ba-22b2f4794659",
"name": null,
"polling_interval": null,
"selected": {
"0d": {
"flag": false,
"indices": []
},
"1d": {
"indices": []
},
"2d": {
"indices": []
}
},
"tags": []
},
"id": "98883a7e-f288-4987-96ba-22b2f4794659",
"type": "RemoteSource"
}
]
ServerDataSource
(**kwargs)¶Bases: bokeh.models.sources.BlazeDataSource
A data source that referes to data located on a Bokeh server.
The data from the server is loaded on-demand by the client.
[
{
"attributes": {
"callback": null,
"column_names": [],
"data": {},
"data_url": null,
"doc": null,
"expr": {},
"id": "190aed14-2a24-45af-b746-2b5b5e83b47f",
"local": null,
"name": null,
"namespace": {},
"polling_interval": null,
"selected": {
"0d": {
"flag": false,
"indices": []
},
"1d": {
"indices": []
},
"2d": {
"indices": []
}
},
"tags": [],
"transform": {}
},
"id": "190aed14-2a24-45af-b746-2b5b5e83b47f",
"type": "ServerDataSource"
}
]