Skip to content

Commit 0908967

Browse files
committed
Line alignment, replace print function, add 'pass'
1 parent 9fd9796 commit 0908967

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

doc/source/basics.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ To evaluate single-element pandas objects in a boolean context, use the method
307307

308308
.. code-block:: python
309309
310-
>>> if df: # noqa: E999
310+
>>> if df:
311+
... pass
311312
312313
Or
313314

@@ -1507,8 +1508,9 @@ Thus, for example, iterating over a DataFrame gives you the column names:
15071508

15081509
.. ipython:: python
15091510
1510-
df = pd.DataFrame(
1511-
{'col1': np.random.randn(3), 'col2': np.random.randn(3)},
1511+
df = pd.DataFrame({
1512+
'col1': np.random.randn(3),
1513+
'col2': np.random.randn(3)},
15121514
index=['a', 'b', 'c'])
15131515
15141516
for col in df:
@@ -1594,7 +1596,7 @@ index value along with a Series containing the data in each row:
15941596
.. ipython:: python
15951597
15961598
for row_index, row in df.iterrows():
1597-
print('%s\n%s' % (row_index, row))
1599+
print(row_index, row, sep='\n')
15981600
15991601
.. note::
16001602

@@ -1972,7 +1974,8 @@ with the data type of each column.
19721974
C='foo',
19731975
D=pd.Timestamp('20010102'),
19741976
E=pd.Series([1.0] * 3).astype('float32'),
1975-
F=False, G=pd.Series([1] * 3, dtype='int8')))
1977+
F=False,
1978+
G=pd.Series([1] * 3, dtype='int8')))
19761979
dft
19771980
dft.dtypes
19781981
@@ -2013,8 +2016,8 @@ different numeric dtypes will **NOT** be combined. The following example will gi
20132016
df1.dtypes
20142017
df2 = pd.DataFrame(dict(A=pd.Series(np.random.randn(8), dtype='float16'),
20152018
B=pd.Series(np.random.randn(8)),
2016-
C=pd.Series(np.array(
2017-
np.random.randn(8), dtype='uint8'))))
2019+
C=pd.Series(np.array(np.random.randn(8),
2020+
dtype='uint8'))))
20182021
df2
20192022
df2.dtypes
20202023

0 commit comments

Comments
 (0)