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

pandas/eland inconsistency for DataFrame.hist #115

Open
stevedodson opened this issue Jan 17, 2020 · 3 comments
Open

pandas/eland inconsistency for DataFrame.hist #115

stevedodson opened this issue Jan 17, 2020 · 3 comments
Assignees
Labels
bug Something isn't working topic:dataframe Issue or PR about eland.DataFrame topic:plotting Issue or PR about plotting with Eland

Comments

@stevedodson
Copy link
Contributor

See issue in cells 13-17 of notebook.

churn.csv.gz

Churn Results EDA.ipynb.gz

image

@stevedodson stevedodson added the bug Something isn't working label Jan 17, 2020
@stevedodson stevedodson self-assigned this Jan 27, 2020
@stevedodson
Copy link
Contributor Author

Resolved by #117

@stevedodson
Copy link
Contributor Author

Still an issue with histograms and categorical columns:

feature='international plan'

df[df.churn==0][feature].hist(density=True, alpha=0.5)
df[df.churn==1][feature].hist(density=True, alpha=0.5)
plt.show()

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-13-7bbc4512e82d> in <module>
      1 feature='international plan'
      2 
----> 3 df[df.churn==0][feature].hist(density=True, alpha=0.5)
      4 df[df.churn==1][feature].hist(density=True, alpha=0.5)
      5 plt.show()

~/PycharmProjects/eland/eland/plotting/_core.py in ed_hist_series(self, by, ax, grid, xlabelsize, xrot, ylabelsize, yrot, figsize, bins, **kwds)
     57         figsize=figsize,
     58         bins=bins,
---> 59         **kwds
     60     )
     61 

~/PycharmProjects/eland/eland/plotting/_matplotlib/hist.py in hist_series(self, by, ax, grid, xlabelsize, xrot, ylabelsize, yrot, figsize, bins, **kwds)
     56         self_weights = self_weights.squeeze()
     57 
---> 58         ax.hist(self_bins[:-1], bins=self_bins, weights=self_weights, **kwds)
     59         ax.grid(grid)
     60         axes = np.array([ax])

~/anaconda3/envs/eland/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1599     def inner(ax, *args, data=None, **kwargs):
   1600         if data is None:
-> 1601             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1602 
   1603         bound = new_sig.bind(ax, *args, **kwargs)

~/anaconda3/envs/eland/lib/python3.7/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, normed, **kwargs)
   6765             # this will automatically overwrite bins,
   6766             # so that each histogram uses the same bins
-> 6767             m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
   6768             m = m.astype(float)  # causes problems later if it's an int
   6769             if mlast is None:

<__array_function__ internals> in histogram(*args, **kwargs)

~/anaconda3/envs/eland/lib/python3.7/site-packages/numpy/lib/histograms.py in histogram(a, bins, range, normed, weights, density)
    793     a, weights = _ravel_and_check_weights(a, weights)
    794 
--> 795     bin_edges, uniform_bins = _get_bin_edges(a, bins, range, weights)
    796 
    797     # Histogram is an integer or a float array depending on the weights.

~/anaconda3/envs/eland/lib/python3.7/site-packages/numpy/lib/histograms.py in _get_bin_edges(a, bins, range, weights)
    436 
    437     else:
--> 438         raise ValueError('`bins` must be 1d, when an array')
    439 
    440     if n_equal_bins is not None:

ValueError: `bins` must be 1d, when an array

@sethmlarson sethmlarson added the topic:dataframe Issue or PR about eland.DataFrame label Apr 3, 2020
@sethmlarson sethmlarson added the topic:plotting Issue or PR about plotting with Eland label May 19, 2020
@V1NAY8
Copy link
Contributor

V1NAY8 commented Nov 12, 2020

@sethmlarson / @stevedodson Can you please summarize on what exactly the issue is? 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic:dataframe Issue or PR about eland.DataFrame topic:plotting Issue or PR about plotting with Eland
Projects
None yet
Development

No branches or pull requests

3 participants