Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
List of lists of categorical data failing: Scatter ravel is performed before _process_unit_info() is called.#27035
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -249,11 +249,13 @@ def test_update_plot(self, plotter): | ||
failing_test_cases = [("mixed", ['A', 3.14]), | ||
("number integer", ['1', 1]), | ||
("string integer", ['42', 42]), | ||
("nested categorical", [["a", "b"], ["c", "d"]]), | ||
("missing", ['12', np.nan])] | ||
fids, fvalues = zip(*failing_test_cases) | ||
plotters = [pytest.param(Axes.scatter, marks=pytest.mark.xfail), | ||
Axes.bar, | ||
pytest.param(Axes.plot, marks=pytest.mark.xfail)] | ||
@pytest.mark.parametrize("plotter", plotters) | ||
@@ -321,3 +323,33 @@ def test_set_lim(): | ||
ax.plot(["a", "b", "c", "d"], [1, 2, 3, 4]) | ||
with warnings.catch_warnings(): | ||
ax.set_xlim("b", "c") | ||
categorical_examples = [("nested categorical", [["a", "b"], ["c", "d"]]), | ||
("nested with nan", [['0', np.nan], ["aa", "bb"]]), | ||
("nested mixed", [[1, 'a'], ['b', np.nan]])] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. By mixed, I meant what happens for [[1,2], ['a', 'b']] -> they all get cased to the same type b/c they get raveled into one list, so what happens then? | ||
cids, cvalues = zip(*categorical_examples) | ||
@pytest.mark.parametrize("xdata", cvalues, ids=cids) | ||
@pytest.mark.parametrize("ydata", cvalues, ids=cids) | ||
def test_nested_categorical(xdata, ydata): | ||
ax = plt.figure().subplots() | ||
ax.scatter(xdata, ydata) | ||
xtexts = [xelement._text for xelement in ax.get_xticklabels()] | ||
assert np.all(xtexts == np.ma.ravel(xdata)) | ||
@pytest.mark.parametrize("xdata", cvalues, ids=cids) | ||
def test_nested_categorical_and_numerical(xdata): | ||
ydata = [[0, 1], [2, 3]] | ||
ax = plt.figure().subplots() | ||
splot = ax.scatter(xdata, ydata) | ||
xtexts = [xelement._text for xelement in ax.get_xticklabels()] | ||
y_offset_processed = list(zip(*splot.get_offsets()))[1] | ||
assert np.all(xtexts == np.ma.ravel(xdata)) | ||
assert np.all(np.ma.ravel(ydata) == y_offset_processed) |