diff --git a/Tests/test_GeoPandasBokeh.py b/Tests/test_GeoPandasBokeh.py
index 5aad9f1..4b75cce 100644
--- a/Tests/test_GeoPandasBokeh.py
+++ b/Tests/test_GeoPandasBokeh.py
@@ -8,17 +8,15 @@
import pandas_bokeh
directory = os.path.dirname(__file__)
-test_sets_directory = os.path.join(
- os.path.dirname(directory), "docs", "Testdata"
-)
+test_sets_directory = os.path.join(os.path.dirname(directory), "docs", "Testdata")
os.makedirs(os.path.join(directory, "Plots"), exist_ok=True)
+
@pytest.fixture
def df_states():
- return gpd.read_file(
- os.path.join(test_sets_directory, "states", "states.geojson")
- )
+ return gpd.read_file(os.path.join(test_sets_directory, "states", "states.geojson"))
+
@pytest.fixture
def df_cities():
@@ -31,14 +29,13 @@ def df_cities():
)
)
+
def test_geolayers_simple(df_states):
"Tests for simple geoplot"
figure = df_states.plot_bokeh(simplify_shapes=10000, show_figure=False)
- with open(
- os.path.join(directory, "Plots", "Geolayers_Simple.html"), "w"
- ) as f:
+ with open(os.path.join(directory, "Plots", "Geolayers_Simple.html"), "w") as f:
f.write(pandas_bokeh.embedded_html(figure))
assert True
@@ -108,11 +105,12 @@ def test_geolayers_slider(df_states, df_cities):
) as f:
f.write(html_multilayer_slider)
+
def test_hole_geplot():
"Tests for (multi-)polygones with holes."
df = gpd.GeoDataFrame.from_file(
- os.path.join(test_sets_directory, 'hole_shapes', 'hole_shapes.geojson')
+ os.path.join(test_sets_directory, "hole_shapes", "hole_shapes.geojson")
)
figure = df.plot_bokeh(show_figure=False)
@@ -122,4 +120,3 @@ def test_hole_geplot():
f.write(pandas_bokeh.embedded_html(figure))
assert True
-
diff --git a/Tests/test_PySpark.py b/Tests/test_PySpark.py
index 6c4536c..bbeb213 100644
--- a/Tests/test_PySpark.py
+++ b/Tests/test_PySpark.py
@@ -7,7 +7,7 @@
import pytest
# only run tests for Python <= 3.7 due to pyspark support:
-if sys.version_info[1] < 8:
+if sys.version_info[1] < 8:
directory = os.path.dirname(__file__)
os.makedirs(os.path.join(directory, "Plots"), exist_ok=True)
@@ -16,19 +16,21 @@
def spark():
# Start PySpark
from pyspark.sql import SparkSession
+
spark = SparkSession.builder.getOrCreate()
yield spark
spark.stop()
-
def test_basic_lineplot_pyspark(spark):
"""Test for basic lineplot with Pyspark"""
# Create basic lineplot:
np.random.seed(42)
df = pd.DataFrame(
- {"Google": np.random.randn(1000) + 0.2,
- "Apple": np.random.randn(1000) + 0.17},
+ {
+ "Google": np.random.randn(1000) + 0.2,
+ "Apple": np.random.randn(1000) + 0.17,
+ },
index=pd.date_range("1/1/2000", periods=1000),
)
df.index.name = "Date"
@@ -40,7 +42,9 @@ def test_basic_lineplot_pyspark(spark):
# Output plot as HTML:
output = pandas_bokeh.row([p_basic_lineplot, p_basic_lineplot_accessor])
- with open(os.path.join(directory, "Plots", "Basic_lineplot_PySpark.html"), "w") as f:
+ with open(
+ os.path.join(directory, "Plots", "Basic_lineplot_PySpark.html"), "w"
+ ) as f:
f.write(pandas_bokeh.embedded_html(output))
- assert True
\ No newline at end of file
+ assert True
diff --git a/docs/github-pages/replace_pictures_with_Bokeh_plots.py b/docs/github-pages/replace_pictures_with_Bokeh_plots.py
index 587742e..6527a52 100644
--- a/docs/github-pages/replace_pictures_with_Bokeh_plots.py
+++ b/docs/github-pages/replace_pictures_with_Bokeh_plots.py
@@ -34,10 +34,14 @@
for plotname, plot in plots.items():
print(f"Replace image {plotname}")
if re.search(r"!\[{plotname}\]\(.+\)".format(plotname=plotname), readme):
- to_replace = re.search(r"!\[{plotname}\]\(.+\)".format(plotname=plotname), readme).group()
+ to_replace = re.search(
+ r"!\[{plotname}\]\(.+\)".format(plotname=plotname), readme
+ ).group()
readme = readme.replace(to_replace, f'
\n\n{plot}\n\n
')
else:
- raise KeyError(f"No image with name '{plotname}' has been found in the README file '{readme_file}'.")
+ raise KeyError(
+ f"No image with name '{plotname}' has been found in the README file '{readme_file}'."
+ )
# Replace path to remaining pictures:
readme = readme.replace(r"![](docs/Images/Pandas-Bokeh-Logo.png)", "")
diff --git a/pandas_bokeh/geoplot.py b/pandas_bokeh/geoplot.py
index 636b8c5..8d78333 100644
--- a/pandas_bokeh/geoplot.py
+++ b/pandas_bokeh/geoplot.py
@@ -26,7 +26,7 @@
def _get_background_tile(provider_name):
- """Returns a Bokeh WTMS Tile Provider Source from . If
+ """Returns a Bokeh WTMS Tile Provider Source from . If
/{Z}/{X}/{Y}*.png' or '/{Z}/{Y}/{X}*.png'."""
from bokeh.models import WMTSTileSource
@@ -89,7 +89,7 @@ def _get_figure(col):
def convert_geoDataFrame_to_patches(gdf, geometry_column):
- """Creates from a geoDataFrame with Polygons and Multipolygons a Pandas DataFrame
+ """Creates from a geoDataFrame with Polygons and Multipolygons a Pandas DataFrame
with x any y columns specifying the geometry of the Polygons."""
df_new = []
diff --git a/pandas_bokeh/plot.py b/pandas_bokeh/plot.py
index 70ff462..12b6b65 100644
--- a/pandas_bokeh/plot.py
+++ b/pandas_bokeh/plot.py
@@ -180,18 +180,18 @@ def plot(
--------
>>> df.plot_bokeh.line()
>>> df.plot_bokeh.scatter(x='x',y='y')
-
+
These plotting methods can also be accessed by calling the accessor as a
method with the ``kind`` argument (except of "map" plot):
``df.plot_bokeh(kind='line')`` is equivalent to ``df.plot_bokeh.line()``
For more information about the individual plot kind implementations, have a
look at the underlying method accessors (like df.plot_bokeh.line) or visit
- https://github.com/PatrikHlobil/Pandas-Bokeh.
+ https://github.com/PatrikHlobil/Pandas-Bokeh.
If `sizing_mode` is not fixed (default), it will overide the set plot width or height
depending on which axis it is scaled on.
-
+
"""
# Make a local copy of the DataFrame:
@@ -1818,7 +1818,7 @@ def line(self, x=None, y=None, **kwargs):
Returns
-------
-
+
Bokeh.plotting.figure or Bokeh.layouts.row
Examples
@@ -1869,7 +1869,7 @@ def step(self, x=None, y=None, **kwargs):
Returns
-------
-
+
Bokeh.plotting.figure or Bokeh.layouts.row
Examples
@@ -1920,7 +1920,7 @@ def point(self, x=None, y=None, **kwargs):
Returns
-------
-
+
Bokeh.plotting.figure or Bokeh.layouts.row
Examples
@@ -2294,9 +2294,9 @@ def scatter(self, x, y, category=None, **kwds):
The column name or column position to be used as vertical
coordinates for each point.
- category : str or object
+ category : str or object
A column name whose values will be used to color the
- marker points according to a colormap.
+ marker points according to a colormap.
**kwds
Keyword arguments to pass on to :meth:`pandas.DataFrame.plot_bokeh`.
@@ -2422,7 +2422,7 @@ def map(self, x, y, **kwds):
def _initialize_rangetool(p, x_axis_type, source):
"""
Initializes the range tool chart and slider.
-
+
Parameters
----------
p : Bokeh.plotting.figure
diff --git a/setup.py b/setup.py
index 6fe8b1e..3ff49c3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,7 @@
import setuptools
import pandas_bokeh
+
version = pandas_bokeh.__version__
long_description = f"""# Pandas Bokeh
@@ -67,7 +68,6 @@
"""
-
setuptools.setup(
name="pandas-bokeh",
version=version,
@@ -85,9 +85,9 @@
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
- 'Intended Audience :: Science/Research',
- 'Topic :: Scientific/Engineering',
- 'Topic :: Scientific/Engineering :: Visualization'
+ "Intended Audience :: Science/Research",
+ "Topic :: Scientific/Engineering",
+ "Topic :: Scientific/Engineering :: Visualization",
],
- python_requires=">=3.6"
+ python_requires=">=3.6",
)