code stringlengths 3 6.57k |
|---|
test_histtype_argument(self, histtype, expected) |
DataFrame(np.random.randint(1, 10, size=(100, 2) |
df.hist(histtype=histtype) |
self._check_patches_all_filled(ax, filled=expected) |
pytest.mark.parametrize("by", [None, "c"]) |
pytest.mark.parametrize("column", [None, "b"]) |
test_hist_with_legend(self, by, column) |
Index(15 * ["1"] + 15 * ["2"], name="c") |
DataFrame(np.random.randn(30, 2) |
self._check_axes_shape(axes, axes_num=expected_axes_num, layout=expected_layout) |
zip(expected_labels, axes) |
self._check_legend_labels(ax, expected_label) |
pytest.mark.parametrize("by", [None, "c"]) |
pytest.mark.parametrize("column", [None, "b"]) |
test_hist_with_legend_raises(self, by, column) |
Index(15 * ["1"] + 15 * ["2"], name="c") |
DataFrame(np.random.randn(30, 2) |
pytest.raises(ValueError, match="Cannot use both legend and label") |
df.hist(legend=True, by=by, column=column, label="d") |
TestDataFrameGroupByPlots(TestPlotBase) |
test_grouped_hist_legacy(self) |
DataFrame(np.random.randn(500, 1) |
np.random.randint(0, 4, 500) |
_grouped_hist(df.A, by=df.C) |
self._check_axes_shape(axes, axes_num=4, layout=(2, 2) |
tm.close() |
df.hist(by=df.C) |
self._check_axes_shape(axes, axes_num=4, layout=(2, 2) |
tm.close() |
df.hist(by="D", rot=30) |
self._check_axes_shape(axes, axes_num=1, layout=(1, 1) |
self._check_ticks_props(axes, xrot=30) |
tm.close() |
bin (index 5) |
axes.ravel() |
ax.get_children() |
isinstance(x, Rectangle) |
get_height() |
tm.assert_almost_equal(height, 1.0) |
tm.close() |
_grouped_hist(df.A, by=df.C, log=True) |
self._check_ax_scales(axes, yaxis="log") |
tm.close() |
pytest.raises(AttributeError) |
_grouped_hist(df.A, by=df.C, foo="bar") |
pytest.raises(ValueError, match=msg) |
df.hist(by="C", figsize="default") |
test_grouped_hist_legacy2(self) |
Series(np.random.normal(166, 20, size=n) |
Series(np.random.normal(60, 10, size=n) |
tm.RNGContext(42) |
np.random.choice([0, 1], size=n) |
DataFrame({"height": height, "weight": weight, "gender": gender_int}) |
df_int.groupby("gender") |
gb.hist() |
len(axes) |
len(self.plt.get_fignums() |
tm.close() |
test_grouped_hist_layout(self) |
pytest.raises(ValueError, match=msg) |
df.hist(column="weight", by=df.gender, layout=(1, 1) |
pytest.raises(ValueError, match=msg) |
df.hist(column="height", by=df.category, layout=(1, 3) |
pytest.raises(ValueError, match=msg) |
df.hist(column="height", by=df.category, layout=(-1, -1) |
tm.assert_produces_warning(UserWarning) |
self._check_axes_shape(axes, axes_num=2, layout=(2, 1) |
tm.assert_produces_warning(UserWarning) |
self._check_axes_shape(axes, axes_num=2, layout=(2, 1) |
df.hist(column="height", by=df.category, layout=(4, 1) |
self._check_axes_shape(axes, axes_num=4, layout=(4, 1) |
df.hist(column="height", by=df.category, layout=(-1, 1) |
self._check_axes_shape(axes, axes_num=4, layout=(4, 1) |
df.hist(column="height", by=df.category, layout=(4, 2) |
self._check_axes_shape(axes, axes_num=4, layout=(4, 2) |
tm.close() |
tm.assert_produces_warning(UserWarning) |
self._check_axes_shape(axes, axes_num=3, layout=(2, 2) |
tm.assert_produces_warning(UserWarning) |
_check_plot_works(df.hist, by="classroom") |
self._check_axes_shape(axes, axes_num=3, layout=(2, 2) |
df.hist(by="gender", layout=(3, 5) |
self._check_axes_shape(axes, axes_num=2, layout=(3, 5) |
df.hist(column=["height", "weight", "category"]) |
self._check_axes_shape(axes, axes_num=3, layout=(2, 2) |
test_grouped_hist_multiple_axes(self) |
self.plt.subplots(2, 3) |
df.hist(column=["height", "weight", "category"], ax=axes[0]) |
self._check_axes_shape(returned, axes_num=3, layout=(1, 3) |
tm.assert_numpy_array_equal(returned, axes[0]) |
df.hist(by="classroom", ax=axes[1]) |
self._check_axes_shape(returned, axes_num=3, layout=(1, 3) |
tm.assert_numpy_array_equal(returned, axes[1]) |
pytest.raises(ValueError) |
self.plt.subplots(2, 3) |
df.hist(column="height", ax=axes) |
test_axis_share_x(self) |
df.hist(column="height", by=df.gender, sharex=True) |
ax1._shared_x_axes.joined(ax1, ax2) |
ax2._shared_x_axes.joined(ax1, ax2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.