Skip to content
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

Incompatibility with Datashader.by #4420

Closed
hoorayphyer opened this issue May 13, 2020 · 8 comments
Closed

Incompatibility with Datashader.by #4420

hoorayphyer opened this issue May 13, 2020 · 8 comments

Comments

@hoorayphyer
Copy link

The exciting development of “by” reduction operator of Datashader is not supported as a valid argument to “aggregator” of the HoloViews.datashade. The main issue seems to be about the member “column” enforced in HoloViews.datashade, whereas Datashader.by only has member "columns". It is desirable to incorporate "by" into the workflow of HoloViews.

ALL software version info

HoloViews version : 1.13.2
Datashader version : 0.11.0a4

Description of expected behavior and the observed behavior

Expected to produce plots when called with Datashader.by. Observed to give errors on member "column" not found on Datashader.by objects.

Complete, minimal, self-contained example code that reproduces the issue

import holoviews as hv
hv.notebook_extension('bokeh')
import holoviews.operation.datashader as hd
import datashader as ds
import pandas as pd

df = pd.DataFrame({"x" : [0,1,0,1], "y" : [0,0,1,1], "cat" : [0,1,0,1], "weight" : [0,1,2,3]})
df["cat"] = df["cat"].astype("category")
points = hv.Points(df, kdims=["x","y"], vdims=["cat","weight"])
hd.datashade(points, aggregator=ds.by('cat',ds.sum("weight")) )

Stack traceback and/or browser JavaScript console output

datashader

@jbednar
Copy link
Member

jbednar commented May 13, 2020

Thanks for the heads up! I've got various fixes for by on the spanfixes branch in a Datashader PR. and I've just pushed one more that makes self.column be a property returning the category column. Given that by is unreleased, presumably you are using Datashader from git, and if so it would be great if you could test whether this change is sufficient.

@hoorayphyer
Copy link
Author

@jbednar Actually I was using Datashader installed through conda install -c pyviz/label/dev datashader. But I tried the git version. The way I did follows the developer instructions given here, except that before going from 2 to 3, I did git checkout spanfixes. The error message is now different. Please check below if the printed ds_version was the correct one, in case I did something wrong.
Screenshot_2020-05-13 Untitled

@jbednar
Copy link
Member

jbednar commented May 13, 2020

Ah, ok. I made a slight update to the spanfixes branch and pushed it, but either way I'm able to reproduce your problem, and moreover I can reproduce it just with a count() aggregate that should work, given that count_cat() works:

import holoviews as hv, holoviews.operation.datashader as hd
import datashader as ds, pandas as pd
hv.extension('bokeh')

df = pd.DataFrame({"x" : [0,1,0,1], "y" : [0,0,1,1], "cat" : [0,1,0,-1], "weight" : [0,1,2,32]})
df["cat"] = df["cat"].astype("category")
points = hv.Points(df, kdims=["x","y"], vdims=["cat","weight"])
hd.datashade(points, aggregator=ds.count_cat("cat"), x_sampling=0.2, y_sampling=0.2)

image

hd.datashade(points, aggregator=ds.by("cat", ds.count()), x_sampling=0.2, y_sampling=0.2)

image

hd.datashade(points, aggregator=ds.by("cat", ds.sum("weight")), x_sampling=0.2, y_sampling=0.2)

image

@jbednar
Copy link
Member

jbednar commented May 13, 2020

Looks like holoviews will need some updates, but it would be nice to have those worked out before we release Datashader, in case Datashader also needs updates.

@philippjfr
Copy link
Member

Fixed in #4438

@hoorayphyer
Copy link
Author

hoorayphyer commented May 26, 2020

Fixed in #4438

Thanks, @philippjfr ! It came just in time for me. So do I just conda upgrade holoviews to enjoy the fix or I need to build it from git?

@philippjfr
Copy link
Member

I'll have a build up on the pyviz/label/dev conda channel later today but you can install straight from git as well if you need it asap.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants