@@ -307,7 +307,8 @@ To evaluate single-element pandas objects in a boolean context, use the method
307
307
308
308
.. code-block :: python
309
309
310
- >> > if df: # noqa: E999
310
+ >> > if df:
311
+ ... pass
311
312
312
313
Or
313
314
@@ -1507,8 +1508,9 @@ Thus, for example, iterating over a DataFrame gives you the column names:
1507
1508
1508
1509
.. ipython :: python
1509
1510
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 )},
1512
1514
index = [' a' , ' b' , ' c' ])
1513
1515
1514
1516
for col in df:
@@ -1594,7 +1596,7 @@ index value along with a Series containing the data in each row:
1594
1596
.. ipython :: python
1595
1597
1596
1598
for row_index, row in df.iterrows():
1597
- print (' %s \n %s ' % ( row_index, row) )
1599
+ print (row_index, row, sep = ' \n ' )
1598
1600
1599
1601
.. note ::
1600
1602
@@ -1972,7 +1974,8 @@ with the data type of each column.
1972
1974
C = ' foo' ,
1973
1975
D = pd.Timestamp(' 20010102' ),
1974
1976
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' )))
1976
1979
dft
1977
1980
dft.dtypes
1978
1981
@@ -2013,8 +2016,8 @@ different numeric dtypes will **NOT** be combined. The following example will gi
2013
2016
df1.dtypes
2014
2017
df2 = pd.DataFrame(dict (A = pd.Series(np.random.randn(8 ), dtype = ' float16' ),
2015
2018
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' ))))
2018
2021
df2
2019
2022
df2.dtypes
2020
2023
0 commit comments