-
Notifications
You must be signed in to change notification settings - Fork 18
Pandas 2.2.0 #359
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 2.2.0 #359
Changes from 24 commits
42e27c4
55dec12
a2a1116
06050b5
ef13f21
672bc6c
5d851dc
6d42c9b
1f9857b
64c14c8
e710dfc
f3a6d8f
9610c7b
99c652d
888c979
b30ae7c
8fff3bc
8a16d12
c1e3b8f
ae4182a
1b5b2ad
5e68563
0f6e45e
91eb24e
1ab5407
9a57567
4a1bbf0
ae96746
71c7bac
6ed8648
a009988
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = '2.7.3' | ||
| __version__ = '2.7.4' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,54 +28,50 @@ | |
| class HistPlot(_WeightedMPLPlot, _HistPlot): | ||
|
|
||
| # noqa: disable=D101 | ||
| def _args_adjust(self) -> None: | ||
| def _adjust_bins(self, bins) -> None: | ||
| if ( | ||
| hasattr(self, 'bins') and | ||
| isinstance(self.bins, str) and | ||
| self.bins in ['fd', 'scott', 'sqrt'] | ||
| isinstance(bins, str) and | ||
| bins in ['fd', 'scott', 'sqrt'] | ||
| ): | ||
| self.bins = self._calculate_bins(self.data) | ||
| super()._args_adjust() | ||
| bins = self._calculate_bins(self.data, bins) | ||
| return super()._adjust_bins(bins) | ||
|
|
||
| # noqa: disable=D101 | ||
| def _calculate_bins(self, data): | ||
| def _calculate_bins(self, data, bins): | ||
| if self.logx: | ||
| data = np.log10(data) | ||
| if 'range' in self.kwds and self.kwds['range'] is not None: | ||
| xmin, xmax = self.kwds['range'] | ||
| self.kwds['range'] = (np.log10(xmin), np.log10(xmax)) | ||
| if self._bin_range is not None: | ||
| xmin, xmax = self._bin_range | ||
| self._bin_range = (np.log10(xmin), np.log10(xmax)) | ||
| nd_values = data.infer_objects(copy=False)._get_numeric_data() | ||
| values = np.ravel(nd_values) | ||
| weights = self.kwds.get("weights", None) | ||
| weights = self.weights | ||
| if weights is not None: | ||
| try: | ||
| weights = np.broadcast_to(weights[:, None], nd_values.shape) | ||
| except ValueError: | ||
| pass | ||
| weights = np.broadcast_to(weights[:, None], nd_values.shape) | ||
| weights = np.ravel(weights) | ||
| weights = weights[~isna(values)] | ||
|
|
||
| values = values[~isna(values)] | ||
|
|
||
| if isinstance(self.bins, str) and self.bins in ['fd', 'scott', 'sqrt']: | ||
| if isinstance(bins, str) and bins in ['fd', 'scott', 'sqrt']: | ||
| bins = histogram_bin_edges( | ||
| values, | ||
| weights=weights, | ||
| bins=self.bins, | ||
| bins=bins, | ||
| beta=self.kwds.pop('beta', 'equal'), | ||
| range=self.kwds.get('range', None) | ||
| range=self._bin_range | ||
| ) | ||
| else: | ||
| bins = np.histogram_bin_edges( | ||
| values, | ||
| weights=weights, | ||
| bins=self.bins, | ||
| range=self.kwds.get('range', None) | ||
| bins=bins, | ||
| range=self._bin_range | ||
| ) | ||
| if self.logx: | ||
| bins = 10**bins | ||
| if 'range' in self.kwds and self.kwds['range'] is not None: | ||
| self.kwds['range'] = (xmin, xmax) | ||
| if self._bin_range is not None: | ||
| self._bin_range = (xmin, xmax) | ||
| return bins | ||
|
|
||
| def _get_colors(self, num_colors=None, color_kwds='color'): | ||
|
|
@@ -180,18 +176,18 @@ def __init__( | |
| ) -> None: | ||
| super().__init__(data, bins=bins, bottom=bottom, **kwargs) | ||
|
|
||
| def _calculate_bins(self, data): | ||
| if 'range' not in self.kwds or self.kwds['range'] is None: | ||
| def _calculate_bins(self, data, bins): | ||
| nd_values = data.infer_objects(copy=False)._get_numeric_data() | ||
| values = np.ravel(nd_values) | ||
| values = values[~isna(values)] | ||
|
||
| if self._bin_range is None: | ||
| q = self.kwds.get('q', 5) | ||
| q = quantile_plot_interval(q=q) | ||
| weights = self.kwds.get('weights', None) | ||
| xmin = quantile(data, q[0], weights) | ||
| xmax = quantile(data, q[-1], weights) | ||
| self.kwds['range'] = (xmin, xmax) | ||
| bins = super()._calculate_bins(data) | ||
| self.kwds.pop('range') | ||
| else: | ||
| bins = super()._calculate_bins(data) | ||
| weights = self.weights | ||
| xmin = quantile(values, q[0], weights) | ||
| xmax = quantile(values, q[-1], weights) | ||
| self._bin_range = (xmin, xmax) | ||
| bins = super()._calculate_bins(data, bins) | ||
| return bins | ||
|
|
||
| @classmethod | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.