Skip to content

Commit b47001b

Browse files
committed
DOC: Fixes flake8 issues in whatsnew v0.13.* pandas-dev#24256
Corrected issues in v0.13.1.rst
1 parent e4a529b commit b47001b

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

doc/source/whatsnew/v0.13.0.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,20 @@ API changes
8686

8787
.. code-block:: ipython
8888
89-
In [3]: arr = np.array([1, 2, 3, 4])
89+
In [3]: arr = np.array([1, 2, 3, 4])
9090
91-
In [4]: arr2 = np.array([5, 3, 2, 1])
91+
In [4]: arr2 = np.array([5, 3, 2, 1])
9292
93-
In [5]: arr / arr2
94-
Out[5]: array([0, 0, 1, 4])
93+
In [5]: arr / arr2
94+
Out[5]: array([0, 0, 1, 4])
9595
96-
In [6]: pd.Series(arr) // pd.Series(arr2)
97-
Out[6]:
98-
0 0
99-
1 0
100-
2 1
101-
3 4
102-
dtype: int64
96+
In [6]: pd.Series(arr) // pd.Series(arr2)
97+
Out[6]:
98+
0 0
99+
1 0
100+
2 1
101+
3 4
102+
dtype: int64
103103
104104
True Division
105105

doc/source/whatsnew/v0.13.1.rst

+34-34
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ v0.13.1 (February 3, 2014)
55

66
{{ header }}
77

8-
.. ipython:: python
9-
:suppress:
10-
11-
from pandas import * # noqa F401, F403
128

139

1410
This is a minor release from 0.13.0 and includes a small number of API changes, several new features,
@@ -35,16 +31,16 @@ Highlights include:
3531

3632
.. ipython:: python
3733
38-
df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
34+
df = pd.DataFrame({'A': np.array(['foo', 'bar', 'bah', 'foo', 'bar'])})
3935
df['A'].iloc[0] = np.nan
4036
df
4137
4238
The recommended way to do this type of assignment is:
4339

4440
.. ipython:: python
4541
46-
df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
47-
df.loc[0,'A'] = np.nan
42+
df = pd.DataFrame({'A': np.array(['foo', 'bar', 'bah', 'foo', 'bar'])})
43+
df.loc[0, 'A'] = np.nan
4844
df
4945
5046
Output Formatting Enhancements
@@ -58,28 +54,29 @@ Output Formatting Enhancements
5854
5955
max_info_rows = pd.get_option('max_info_rows')
6056
61-
df = DataFrame(dict(A = np.random.randn(10),
62-
B = np.random.randn(10),
63-
C = date_range('20130101',periods=10)))
64-
df.iloc[3:6,[0,2]] = np.nan
57+
df = pd.DataFrame({'A': np.random.randn(10),
58+
'B': np.random.randn(10),
59+
'C': pd.date_range('20130101', periods=10)
60+
})
61+
df.iloc[3:6, [0, 2]] = np.nan
6562
6663
.. ipython:: python
6764
6865
# set to not display the null counts
69-
pd.set_option('max_info_rows',0)
66+
pd.set_option('max_info_rows', 0)
7067
df.info()
7168
7269
.. ipython:: python
7370
7471
# this is the default (same as in 0.13.0)
75-
pd.set_option('max_info_rows',max_info_rows)
72+
pd.set_option('max_info_rows', max_info_rows)
7673
df.info()
7774
7875
- Add ``show_dimensions`` display option for the new DataFrame repr to control whether the dimensions print.
7976

8077
.. ipython:: python
8178
82-
df = DataFrame([[1, 2], [3, 4]])
79+
df = pd.DataFrame([[1, 2], [3, 4]])
8380
pd.set_option('show_dimensions', False)
8481
df
8582
@@ -89,10 +86,13 @@ Output Formatting Enhancements
8986
- The ``ArrayFormatter`` for ``datetime`` and ``timedelta64`` now intelligently
9087
limit precision based on the values in the array (:issue:`3401`)
9188

92-
Previously output might look like:
93-
94-
.. code-block:: python
89+
Previously output might look like:::
9590

91+
>>> df = pd.DataFrame([pd.Timestamp('20010101'),
92+
pd.Timestamp('20040601')], columns=['age'])
93+
>>> df['today'] = pd.Timestamp('20130419')
94+
>>> df['diff'] = df['today'] - df['age']
95+
>>> df
9696
age today diff
9797
0 2001-01-01 00:00:00 2013-04-19 00:00:00 4491 days, 00:00:00
9898
1 2004-06-01 00:00:00 2013-04-19 00:00:00 3244 days, 00:00:00
@@ -101,10 +101,10 @@ Output Formatting Enhancements
101101

102102
.. ipython:: python
103103
104-
df = DataFrame([ Timestamp('20010101'),
105-
Timestamp('20040601') ], columns=['age'])
106-
df['today'] = Timestamp('20130419')
107-
df['diff'] = df['today']-df['age']
104+
df = pd.DataFrame([pd.Timestamp('20010101'),
105+
pd.Timestamp('20040601')], columns=['age'])
106+
df['today'] = pd.Timestamp('20130419')
107+
df['diff'] = df['today'] - df['age']
108108
df
109109
110110
API changes
@@ -118,7 +118,7 @@ API changes
118118

119119
.. ipython:: python
120120
121-
s = Series(['a', 'a|b', np.nan, 'a|c'])
121+
s = pd.Series(['a', 'a|b', np.nan, 'a|c'])
122122
s.str.get_dummies(sep='|')
123123
124124
- Added the ``NDFrame.equals()`` method to compare if two NDFrames are
@@ -129,8 +129,8 @@ API changes
129129

130130
.. code-block:: python
131131
132-
df = DataFrame({'col':['foo', 0, np.nan]})
133-
df2 = DataFrame({'col':[np.nan, 0, 'foo']}, index=[2,1,0])
132+
df = pd.DataFrame({'col': ['foo', 0, np.nan]})
133+
df2 = pd.DataFrame({'col': [np.nan, 0, 'foo']}, index=[2, 1, 0])
134134
df.equals(df2)
135135
df.equals(df2.sort_index())
136136
@@ -221,7 +221,7 @@ Enhancements
221221
shades = ['light', 'dark']
222222
colors = ['red', 'green', 'blue']
223223
224-
MultiIndex.from_product([shades, colors], names=['shade', 'color'])
224+
pd.MultiIndex.from_product([shades, colors], names=['shade', 'color'])
225225
226226
- Panel :meth:`~pandas.Panel.apply` will work on non-ufuncs. See :ref:`the docs<basics.apply_panel>`.
227227

@@ -255,30 +255,30 @@ Enhancements
255255

256256
.. ipython:: python
257257
258-
result = panel.apply(
259-
lambda x: (x-x.mean())/x.std(),
260-
axis='major_axis')
258+
result = panel.apply(lambda x: (x - x.mean()) / x.std(),
259+
axis='major_axis')
261260
result
262261
result['ItemA']
263262
264263
- Panel :meth:`~pandas.Panel.apply` operating on cross-sectional slabs. (:issue:`1148`)
265264

266265
.. ipython:: python
267266
268-
f = lambda x: ((x.T-x.mean(1))/x.std(1)).T
267+
def f(x):
268+
return ((x.T - x.mean(1)) / x.std(1)).T
269269
270-
result = panel.apply(f, axis = ['items','major_axis'])
270+
result = panel.apply(f, axis=['items', 'major_axis'])
271271
result
272-
result.loc[:,:,'ItemA']
272+
result.loc[:, :, 'ItemA']
273273
274274
This is equivalent to the following
275275

276276
.. ipython:: python
277277
278-
result = Panel(dict([ (ax,f(panel.loc[:,:,ax]))
279-
for ax in panel.minor_axis ]))
278+
result = pd.Panel({ax: f(panel.loc[:, :, ax]) for ax in panel.minor_axis})
279+
280280
result
281-
result.loc[:,:,'ItemA']
281+
result.loc[:, :, 'ItemA']
282282
283283
Performance
284284
~~~~~~~~~~~

0 commit comments

Comments
 (0)