Skip to content

Commit a034332

Browse files
committed
Debug
1 parent a92650d commit a034332

File tree

1 file changed

+29
-84
lines changed

1 file changed

+29
-84
lines changed

doc/source/whatsnew/v0.23.0.rst

Lines changed: 29 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -11,101 +11,46 @@ What's new in 0.23.0 (May 15, 2018)
1111
from pandas import * # noqa F401, F403
1212
1313
14-
This is a major release from 0.22.0 and includes a number of API changes,
15-
deprecations, new features, enhancements, and performance improvements along
16-
with a large number of bug fixes. We recommend that all users upgrade to this
17-
version.
18-
19-
Highlights include:
20-
21-
- :ref:`Round-trippable JSON format with 'table' orient <whatsnew_0230.enhancements.round-trippable_json>`.
22-
- :ref:`Instantiation from dicts respects order for Python 3.6+ <whatsnew_0230.api_breaking.dict_insertion_order>`.
23-
- :ref:`Dependent column arguments for assign <whatsnew_0230.enhancements.assign_dependent>`.
24-
- :ref:`Merging / sorting on a combination of columns and index levels <whatsnew_0230.enhancements.merge_on_columns_and_levels>`.
25-
- :ref:`Extending pandas with custom types <whatsnew_023.enhancements.extension>`.
26-
- :ref:`Excluding unobserved categories from groupby <whatsnew_0230.enhancements.categorical_grouping>`.
27-
- :ref:`Changes to make output shape of DataFrame.apply consistent <whatsnew_0230.api_breaking.apply>`.
28-
29-
Check the :ref:`API Changes <whatsnew_0230.api_breaking>` and :ref:`deprecations <whatsnew_0230.deprecations>` before updating.
30-
31-
.. warning::
32-
33-
Starting January 1, 2019, pandas feature releases will support Python 3 only.
34-
See `Dropping Python 2.7 <https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27>`_ for more.
35-
36-
.. contents:: What's new in v0.23.0
37-
:local:
38-
:backlinks: none
39-
:depth: 2
40-
41-
.. _whatsnew_0230.enhancements:
42-
43-
New features
44-
~~~~~~~~~~~~
45-
46-
.. _whatsnew_0230.enhancements.round-trippable_json:
47-
48-
JSON read/write round-trippable with ``orient='table'``
49-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50-
51-
A ``DataFrame`` can now be written to and subsequently read back via JSON while preserving metadata through usage of the ``orient='table'`` argument (see :issue:`18912` and :issue:`9146`). Previously, none of the available ``orient`` values guaranteed the preservation of dtypes and index names, amongst other metadata.
52-
53-
.. code-block:: ipython
14+
.. ipython:: python
15+
:okwarning:
5416
55-
In [1]: df = pd.DataFrame({'foo': [1, 2, 3, 4],
56-
...: 'bar': ['a', 'b', 'c', 'd'],
57-
...: 'baz': pd.date_range('2018-01-01', freq='D', periods=4),
58-
...: 'qux': pd.Categorical(['a', 'b', 'c', 'c'])},
59-
...: index=pd.Index(range(4), name='idx'))
17+
df.index.name = 'index'
6018
61-
In [2]: df
62-
Out[2]:
63-
foo bar baz qux
64-
idx
65-
0 1 a 2018-01-01 a
66-
1 2 b 2018-01-02 b
67-
2 3 c 2018-01-03 c
68-
3 4 d 2018-01-04 c
19+
df.to_json('test.json', orient='table')
20+
new_df = pd.read_json('test.json', orient='table')
21+
new_df
22+
new_df.dtypes
6923
70-
[4 rows x 4 columns]
24+
.. ipython:: python
25+
:suppress:
7126
72-
In [3]: df.dtypes
73-
Out[3]:
74-
foo int64
75-
bar object
76-
baz datetime64[ns]
77-
qux category
78-
Length: 4, dtype: object
27+
import os
28+
os.remove('test.json')
7929
80-
In [4]: df.to_json('test.json', orient='table')
30+
.. ipython:: python
8131
82-
In [5]: new_df = pd.read_json('test.json', orient='table')
32+
df = pd.DataFrame({'A': [1, 2, 3]})
33+
df
34+
df.assign(B=df.A, C=lambda x: x['A'] + x['B'])
8335
84-
In [6]: new_df
85-
Out[6]:
86-
foo bar baz qux
87-
idx
88-
0 1 a 2018-01-01 a
89-
1 2 b 2018-01-02 b
90-
2 3 c 2018-01-03 c
91-
3 4 d 2018-01-04 c
36+
.. ipython:: python
9237
93-
[4 rows x 4 columns]
38+
df.assign(A=df.A + 1, C=lambda df: df.A * -1)
9439
95-
In [7]: new_df.dtypes
96-
Out[7]:
97-
foo int64
98-
bar object
99-
baz datetime64[ns]
100-
qux category
101-
Length: 4, dtype: object
40+
.. ipython:: python
10241
103-
Please note that the string ``index`` is not supported with the round trip format, as it is used by default in ``write_json`` to indicate a missing index name.
42+
left_index = pd.Index(['K0', 'K0', 'K1', 'K2'], name='key1')
10443
44+
left = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'],
45+
'B': ['B0', 'B1', 'B2', 'B3'],
46+
'key2': ['K0', 'K1', 'K0', 'K1']},
47+
index=left_index)
10548
106-
.. _whatsnew_0.23.0.contributors:
49+
right_index = pd.Index(['K0', 'K1', 'K2', 'K2'], name='key1')
10750
108-
Contributors
109-
~~~~~~~~~~~~
51+
right = pd.DataFrame({'C': ['C0', 'C1', 'C2', 'C3'],
52+
'D': ['D0', 'D1', 'D2', 'D3'],
53+
'key2': ['K0', 'K0', 'K0', 'K1']},
54+
index=right_index)
11055
111-
.. contributors:: v0.22.0..v0.23.0
56+
left.merge(right, on=['key1', 'key2'])

0 commit comments

Comments
 (0)