Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,16 @@ def test_irreg_hf(self):
_, ax = self.plt.subplots()
df2 = df.copy()
df2.index = df.index.astype(object)
df2.plot(ax=ax)
diffs = Series(ax.get_lines()[0].get_xydata()[:, 0]).diff()
assert (np.fabs(diffs[1:] - sec) < 1e-8).all()
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
# This warning will be emitted
# pandas/core/frame.py:3216:
# FutureWarning: Automatically casting object-dtype Index of datetimes
# to DatetimeIndex is deprecated and will be removed in a future version.
# Explicitly cast to DatetimeIndex instead.
# return klass(values, index=self.index, name=name, fastpath=True)
df2.plot(ax=ax)
diffs = Series(ax.get_lines()[0].get_xydata()[:, 0]).diff()
assert (np.fabs(diffs[1:] - sec) < 1e-8).all()

def test_irregular_datetime64_repr_bug(self):
ser = tm.makeTimeSeries()
Expand Down Expand Up @@ -1028,9 +1035,16 @@ def test_irreg_dtypes(self):
# np.datetime64
idx = date_range("1/1/2000", periods=10)
idx = idx[[0, 2, 5, 9]].astype(object)
df = DataFrame(np.random.randn(len(idx), 3), idx)
_, ax = self.plt.subplots()
_check_plot_works(df.plot, ax=ax)
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
# This warning will be emitted
# pandas/core/frame.py:3216:
# FutureWarning: Automatically casting object-dtype Index of datetimes
# to DatetimeIndex is deprecated and will be removed in a future version.
# Explicitly cast to DatetimeIndex instead.
# return klass(values, index=self.index, name=name, fastpath=True)
df = DataFrame(np.random.randn(len(idx), 3), idx)
_, ax = self.plt.subplots()
_check_plot_works(df.plot, ax=ax)

@pytest.mark.slow
def test_time(self):
Expand Down