-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add datetime testing for boxplot #26986
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
Changes from all commits
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ | |||||||||
import numpy as np | ||||||||||
|
||||||||||
import pytest | ||||||||||
|
||||||||||
import pandas as pd | ||||||||||
import matplotlib.pyplot as plt | ||||||||||
import matplotlib as mpl | ||||||||||
|
||||||||||
|
@@ -86,12 +86,19 @@ def test_barh(self): | |||||||||
fig, ax = plt.subplots() | ||||||||||
ax.barh(...) | ||||||||||
|
||||||||||
@pytest.mark.xfail(reason="Test for boxplot not written yet") | ||||||||||
# @pytest.mark.xfail(reason="Test for boxplot not written yet") | ||||||||||
@mpl.style.context("default") | ||||||||||
def test_boxplot(self): | ||||||||||
fig, ax = plt.subplots() | ||||||||||
ax.boxplot(...) | ||||||||||
|
||||||||||
df = pd.DataFrame({'date': pd.to_datetime(['2023-01-01', '2023-02-01', '2023-03-01', '2023-04-01', '2023-05-01']), | ||||||||||
'value': [10, 20, 30, 40, 50]}) | ||||||||||
plt.figure() | ||||||||||
plt.bar(df['value'], df['date']) | ||||||||||
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. A bar graph is not a boxplot, and therefore does fit this unit test Also a (vertical) bar graph with date values on the y axis will generally need a 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. i'll remove the bar graph.. |
||||||||||
df.boxplot(by='date') | ||||||||||
plt.xlabel('Date') | ||||||||||
plt.ylabel('Value') | ||||||||||
plt.title('Boxplot with dates on the x-axis') | ||||||||||
plt.show() | ||||||||||
|
||||||||||
@pytest.mark.xfail(reason="Test for broken_barh not written yet") | ||||||||||
@mpl.style.context("default") | ||||||||||
def test_broken_barh(self): | ||||||||||
|
@@ -395,3 +402,8 @@ def test_vlines(self): | |||||||||
def test_xcorr(self): | ||||||||||
fig, ax = plt.subplots() | ||||||||||
ax.xcorr(...) | ||||||||||
|
||||||||||
instance = TestDatetimePlotting() | ||||||||||
|
||||||||||
|
||||||||||
instance.test_boxplot() | ||||||||||
Comment on lines
+406
to
+409
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.
Suggested change
This seems to have been put in for testing purposes 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. yes this i forgot to remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do a numpy/list of datetime object version of this?
We do not want to test Pandas converters here, we want to test our own. (We actually do have a few tests to make sure we don't fully break pandas elsewhere, but that is not the intent of this module)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay !! I'm gonna change this..