@@ -102,97 +102,6 @@ A ``DataFrame`` can now be written to and subsequently read back via JSON while
102102
103103 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.
104104
105- .. ipython :: python
106- :okwarning:
107-
108- df.index.name = ' index'
109-
110- df.to_json(' test.json' , orient = ' table' )
111- new_df = pd.read_json(' test.json' , orient = ' table' )
112- new_df
113- new_df.dtypes
114-
115- .. ipython :: python
116- :suppress:
117-
118- import os
119- os.remove(' test.json' )
120-
121-
122- .. _whatsnew_0230.enhancements.assign_dependent :
123-
124-
125- Method ``.assign() `` accepts dependent arguments
126- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127-
128- The :func: `DataFrame.assign ` now accepts dependent keyword arguments for python version later than 3.6 (see also `PEP 468
129- <https://www.python.org/dev/peps/pep-0468/> `_). Later keyword arguments may now refer to earlier ones if the argument is a callable. See the
130- :ref: `documentation here <dsintro.chained_assignment >` (:issue: `14207 `)
131-
132- .. ipython :: python
133-
134- df = pd.DataFrame({' A' : [1 , 2 , 3 ]})
135- df
136- df.assign(B = df.A, C = lambda x : x[' A' ] + x[' B' ])
137-
138- .. warning ::
139-
140- This may subtly change the behavior of your code when you're
141- using ``.assign() `` to update an existing column. Previously, callables
142- referring to other variables being updated would get the "old" values
143-
144- Previous behavior:
145-
146- .. code-block :: ipython
147-
148- In [2]: df = pd.DataFrame({"A": [1, 2, 3]})
149-
150- In [3]: df.assign(A=lambda df: df.A + 1, C=lambda df: df.A * -1)
151- Out[3]:
152- A C
153- 0 2 -1
154- 1 3 -2
155- 2 4 -3
156-
157- New behavior:
158-
159- .. ipython :: python
160-
161- df.assign(A = df.A + 1 , C = lambda df : df.A * - 1 )
162-
163-
164-
165- .. _whatsnew_0230.enhancements.merge_on_columns_and_levels :
166-
167- Merging on a combination of columns and index levels
168- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169-
170- Strings passed to :meth: `DataFrame.merge ` as the ``on ``, ``left_on ``, and ``right_on ``
171- parameters may now refer to either column names or index level names.
172- This enables merging ``DataFrame `` instances on a combination of index levels
173- and columns without resetting indexes. See the :ref: `Merge on columns and
174- levels <merging.merge_on_columns_and_levels>` documentation section.
175- (:issue: `14355 `)
176-
177- .. ipython :: python
178-
179- left_index = pd.Index([' K0' , ' K0' , ' K1' , ' K2' ], name = ' key1' )
180-
181- left = pd.DataFrame({' A' : [' A0' , ' A1' , ' A2' , ' A3' ],
182- ' B' : [' B0' , ' B1' , ' B2' , ' B3' ],
183- ' key2' : [' K0' , ' K1' , ' K0' , ' K1' ]},
184- index = left_index)
185-
186- right_index = pd.Index([' K0' , ' K1' , ' K2' , ' K2' ], name = ' key1' )
187-
188- right = pd.DataFrame({' C' : [' C0' , ' C1' , ' C2' , ' C3' ],
189- ' D' : [' D0' , ' D1' , ' D2' , ' D3' ],
190- ' key2' : [' K0' , ' K0' , ' K0' , ' K1' ]},
191- index = right_index)
192-
193- left.merge(right, on = [' key1' , ' key2' ])
194-
195- .. _whatsnew_0230.enhancements.sort_by_columns_and_levels :
196105
197106.. _whatsnew_0.23.0.contributors :
198107
0 commit comments