Skip to content

Commit 68dc4c2

Browse files
STYLE: Inconsistent namespace - plotting (#40276)
1 parent 22f8ee8 commit 68dc4c2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pandas/tests/plotting/frame/test_frame.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ def test_invalid_logscale(self, input_param):
271271
df.plot(**{input_param: "sm"})
272272

273273
def test_xcompat(self):
274-
import pandas as pd
275274

276275
df = self.tdf
277276
ax = df.plot(x_compat=True)
@@ -280,14 +279,14 @@ def test_xcompat(self):
280279
self._check_ticks_props(ax, xrot=30)
281280

282281
tm.close()
283-
pd.plotting.plot_params["xaxis.compat"] = True
282+
plotting.plot_params["xaxis.compat"] = True
284283
ax = df.plot()
285284
lines = ax.get_lines()
286285
assert not isinstance(lines[0].get_xdata(), PeriodIndex)
287286
self._check_ticks_props(ax, xrot=30)
288287

289288
tm.close()
290-
pd.plotting.plot_params["x_compat"] = False
289+
plotting.plot_params["x_compat"] = False
291290

292291
ax = df.plot()
293292
lines = ax.get_lines()
@@ -296,7 +295,7 @@ def test_xcompat(self):
296295

297296
tm.close()
298297
# useful if you're plotting a bunch together
299-
with pd.plotting.plot_params.use("x_compat", True):
298+
with plotting.plot_params.use("x_compat", True):
300299
ax = df.plot()
301300
lines = ax.get_lines()
302301
assert not isinstance(lines[0].get_xdata(), PeriodIndex)
@@ -682,15 +681,15 @@ def test_plot_scatter(self):
682681
def test_raise_error_on_datetime_time_data(self):
683682
# GH 8113, datetime.time type is not supported by matplotlib in scatter
684683
df = DataFrame(np.random.randn(10), columns=["a"])
685-
df["dtime"] = pd.date_range(start="2014-01-01", freq="h", periods=10).time
684+
df["dtime"] = date_range(start="2014-01-01", freq="h", periods=10).time
686685
msg = "must be a string or a number, not 'datetime.time'"
687686

688687
with pytest.raises(TypeError, match=msg):
689688
df.plot(kind="scatter", x="dtime", y="a")
690689

691690
def test_scatterplot_datetime_data(self):
692691
# GH 30391
693-
dates = pd.date_range(start=date(2019, 1, 1), periods=12, freq="W")
692+
dates = date_range(start=date(2019, 1, 1), periods=12, freq="W")
694693
vals = np.random.normal(0, 1, len(dates))
695694
df = DataFrame({"dates": dates, "vals": vals})
696695

@@ -2095,7 +2094,7 @@ def test_x_string_values_ticks(self):
20952094
def test_x_multiindex_values_ticks(self):
20962095
# Test if multiindex plot index have a fixed xtick position
20972096
# GH: 15912
2098-
index = pd.MultiIndex.from_product([[2012, 2013], [1, 2]])
2097+
index = MultiIndex.from_product([[2012, 2013], [1, 2]])
20992098
df = DataFrame(np.random.randn(4, 2), columns=["A", "B"], index=index)
21002099
ax = df.plot()
21012100
ax.set_xlim(-1, 4)

0 commit comments

Comments
 (0)