-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Map Plot #6
Comments
You have to use version 0.1 for the map plots. You can check the version with import pandas_bokeh
print(pandas_bokeh.__version__) You can then upgrade via pip:
If it works, please close the issue. Otherwise, please provide me the error message such that I can check the problem. |
Okay, that worked. The originally installed version was 0.0.2, so the pip upgrade fixed that issue. However, I'm not getting the following error:
Which doesn't seem to make sense because the data set itself has values that are both above and below 90 and -90, respectively. |
Thas is weird, I cannot reproduce your problem. I used the code you pasted above (works both with output_notebook and output_file): import pandas as pd
import pandas_bokeh
pandas_bokeh.output_file("mapplot.html")
df_mapplot = pd.read_csv(r"https://raw.githubusercontent.com/PatrikHlobil/Pandas-Bokeh/master/Documentation/Testdata/populated%20places/populated_places.csv")
df_mapplot["size"] = df_mapplot["pop_max"] / 1000000
df_mapplot.plot_bokeh.map(
x="longitude",
y="latitude",
hovertool_string="""<h2> @{name} </h2>
<h3> Population: @{pop_max} </h3>""",
tile_provider="STAMEN_TERRAIN_RETINA",
size="size",
figsize=(900, 600),
title="World cities with more than 1.000.000 inhabitants") that creates the plot below on my computer: The error message comes from restriction of the latitude (this is actually an error in the ValueError-message since it is not the longitude restriction) of the WGS84 coordinates. The data however does not contain values that exceed this boundaries: df_mapplot.describe()
which created the plot. Can you check your DataFrame with the describe() method? |
Okay, so one set of apt updates, and upgrades later, the example code works properly. But I'm still getting that error with a data set of my own. Here's what happens when I use
|
Could you provide me your dataframe (e.g. as pickle or as parquet)? Then I could try it on my computer and figure out what the problem is. Otherwise, I would propose that you try: and if that works you can try to increase the number of rows that you use for the plot to figure out when the problem occurs. |
Okay, so using head(100) worked, so maybe there's just too many rows in the data set? It is fairly large data from NYC. I'm including the dataframe also: https://we.tl/t-FBr853It7n |
Ok, I found the problem. Your x and y columns contain NaN values. Therefore, checking the min/max values gives NaN and this violates the conditions for latitude and longitude. One should implement a warning that one cannot plot NaN values. The solution for you would be to filter out the rows with NaN values in Latitude or Longitude: df_mapplot = df_mapplot[df_mapplot["Latitude"].notnull()&df_mapplot["Longitude"].notnull()] and then to plot the data. Note however that you shouldn't use output_notebook, but output_file. On my computer the notebook crashed because the output was to big. Also, 600.000 points will probably crash your browser, even when using WebGL which is the default for Pandas Bokeh. |
Thanks for helping with that - I thought I had gotten rid of all of the NaN values, but I guess not. And thanks for the heads up about notebook versus file output. |
You’re welcome. Maybe have a look at the Output and Layouts section of the README.md. This could also be interesting for you... |
Hey @PatrikHlobil, I'm running into a potentially related issue on the map plot example. Using the exact code as in the github readme, I get the error:
Version:
|
Hi @Rendiere , thanks for the bug report. This happens when you don't catch up with all your tests :(. Thisis a new bug and is different from the one desribed above. I already fixed it and it will be available with the next release. If you don't want to wait, just upgrade on the dev version via:
Best, Patrik |
Hi @PatrikHlobil : I am on 0.3 (from conda on a Mac) and I have the same problem as @Rendiere (AttributeError: 'FramePlotMethods' object has no attribute '_data'). I am using the same code as above. Python version 3.7.7 (default, Mar 23 2020, 17:31:31) |
Hi @boustrephon, The conda package is out of date at the moment because there are problems with a dependency relation in used packages. Please install the latest version via pip and report If the issue I solved. Best Patrik |
Hi @boustrephon, @joeborrello, I just fixed the conda build problem and you can now also install the most recent version of pandas-bokeh (0.4.3) via conda via:
Best Patrik |
When I try to run the Mapplot example, I get the following error when I try to use
plot_bokeh.map
:The whole code is as follows:
The text was updated successfully, but these errors were encountered: