8000 ENH: Allow histogramdd to work with mixed edge types · Issue #11024 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Allow histogramdd to work with mixed edge types #11024

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

Open
eric-wieser opened this issue May 1, 2018 · 2 comments
Open

ENH: Allow histogramdd to work with mixed edge types #11024

eric-wieser opened this issue May 1, 2018 · 2 comments

Comments

@eric-wieser
Copy link
Member

It would be great if one axis could be an integer while the other is a float. Supporting datetime / float axes would be handy too.

Fixing this would involve removing the array cast in

    try:
        # Sample is an ND-array.
        N, D = sample.shape
    except (AttributeError, ValueError):
        # Sample is a sequence of 1D arrays.
        sample = np.atleast_2d(sample).T
        N, D = sample.shape`
@tylerjereddy
Copy link
Contributor

Would it be possible to provide an example of the "mixed" input scenario you're describing for clarity? A small code snippet that doesn't work now but that it would be nice if it worked.

@eric-wieser
Copy link
Member Author
eric-wieser commented May 4, 2018

Sure, something like

dates = np.arange('today', 10, dtype=np.datetime64)
values  = np.random.rand(10)
hist, edges = np.histogramdd((dates, values))  # or at least, with explicit edge arguments

assert edges[0].dtype == dates.dtype
assert edges[1].dtype == values.dtype

Right now all the inputs get converted to the same dtype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0