Skip to content

Commit 035a177

Browse files
committed
DOC: Final touches
1 parent c30209d commit 035a177

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/source/basics.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1741,12 +1741,12 @@ Convert a subset of columns to a specified type using :meth:`~DataFrame.astype`
17411741

17421742
:meth:`~DataFrame.loc` tries to fit in what we are assigning to the current dtypes, while ``[]`` will overwrite them taking the dtype from the right hand side. Therefore the following piece of code produces the unintended result.
17431743

1744-
.. ipython:: python
1744+
.. ipython:: python
17451745
1746-
dft = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6], 'c': [7, 8, 9]})
1747-
dft.loc[:, ['a', 'b']].astype(np.uint8).dtypes
1748-
dft.loc[:, ['a', 'b']] = dft.loc[:, ['a', 'b']].astype(np.uint8)
1749-
dft.dtypes
1746+
dft = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6], 'c': [7, 8, 9]})
1747+
dft.loc[:, ['a', 'b']].astype(np.uint8).dtypes
1748+
dft.loc[:, ['a', 'b']] = dft.loc[:, ['a', 'b']].astype(np.uint8)
1749+
dft.dtypes
17501750
17511751
object conversion
17521752
~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)