Skip to content

Commit 2f0bead

Browse files
committed
fix tests, fix an example in v0.20.0
1 parent 8fa731c commit 2f0bead

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

doc/source/whatsnew/v0.20.0.rst

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,26 @@ The new orient ``'table'`` for :meth:`DataFrame.to_json`
308308
will generate a `Table Schema`_ compatible string representation of
309309
the data.
310310

311-
.. ipython:: python
311+
.. code-block:: ipython
312312
313-
df = pd.DataFrame(
314-
{'A': [1, 2, 3],
315-
'B': ['a', 'b', 'c'],
316-
'C': pd.date_range('2016-01-01', freq='d', periods=3)},
317-
index=pd.Index(range(3), name='idx'))
318-
df
319-
df.to_json(orient='table')
313+
In [38]: df = pd.DataFrame(
314+
....: {'A': [1, 2, 3],
315+
....: 'B': ['a', 'b', 'c'],
316+
....: 'C': pd.date_range('2016-01-01', freq='d', periods=3)},
317+
....: index=pd.Index(range(3), name='idx'))
318+
In [39]: df
319+
Out[39]:
320+
A B C
321+
idx
322+
0 1 a 2016-01-01
323+
1 2 b 2016-01-02
324+
2 3 c 2016-01-03
325+
326+
[3 rows x 3 columns]
327+
328+
In [40]: df.to_json(orient='table')
329+
Out[40]:
330+
'{"schema":{"fields":[{"name":"idx","type":"integer"},{"name":"A","type":"integer"},{"name":"B","type":"string"},{"name":"C","type":"datetime"}],"primaryKey":["idx"],"pandas_version":"1.4.0"},"data":[{"idx":0,"A":1,"B":"a","C":"2016-01-01T00:00:00.000"},{"idx":1,"A":2,"B":"b","C":"2016-01-02T00:00:00.000"},{"idx":2,"A":3,"B":"c","C":"2016-01-03T00:00:00.000"}]}'
320331
321332
322333
See :ref:`IO: Table Schema for more information <io.table_schema>`.

pandas/tests/frame/test_query_eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ def test_check_tz_aware_index_query(self, tz_aware_fixture):
751751
# https://github.com/pandas-dev/pandas/issues/29463
752752
tz = tz_aware_fixture
753753
df_index = date_range(
754-
start="2019-01-01", freq="1d", periods=10, tz=tz, name="time"
754+
start="2019-01-01", freq="1D", periods=10, tz=tz, name="time"
755755
)
756756
expected = DataFrame(index=df_index)
757757
df = DataFrame(index=df_index)

pandas/tests/plotting/test_datetimelike.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ def test_format_timedelta_ticks_wide(self):
15431543
"9 days 06:13:20",
15441544
]
15451545

1546-
rng = timedelta_range("0", periods=10, freq="1 d")
1546+
rng = timedelta_range("0", periods=10, freq="1 D")
15471547
df = DataFrame(np.random.default_rng(2).standard_normal((len(rng), 3)), rng)
15481548
_, ax = mpl.pyplot.subplots()
15491549
ax = df.plot(fontsize=2, ax=ax)
@@ -1562,7 +1562,7 @@ def test_timedelta_plot(self):
15621562

15631563
def test_timedelta_long_period(self):
15641564
# test long period
1565-
index = timedelta_range("1 day 2 hr 30 min 10 s", periods=10, freq="1 d")
1565+
index = timedelta_range("1 day 2 hr 30 min 10 s", periods=10, freq="1 D")
15661566
s = Series(np.random.default_rng(2).standard_normal(len(index)), index)
15671567
_, ax = mpl.pyplot.subplots()
15681568
_check_plot_works(s.plot, ax=ax)

0 commit comments

Comments
 (0)